Files
hakorune/local_tests/test_kilo_memory_simple.hako

48 lines
1.9 KiB
Plaintext
Raw Permalink Normal View History

// 🧪 Kilo Memory Efficiency Simple Test - Phase 10 Feature Verification
static box Main {
init { console }
main() {
me.console = new ConsoleBox()
me.console.log("🧪 Phase 10 Kilo Memory Test")
// Simple text buffer simulation
local buffer = new ArrayBox()
me.console.log("📊 Created empty buffer")
// Test 1: Add some text
buffer.push("Hello World")
buffer.push("Second Line")
me.console.log("✅ Added 2 lines: " + buffer.length() + " total")
// Test 2: Memory monitoring simulation
local line_count = buffer.length()
local estimated_memory = line_count * 20 // Simple estimation
me.console.log("📈 Estimated memory: " + estimated_memory + " bytes")
// Test 3: "Accidental full copy" simulation
local old_memory = estimated_memory
buffer.push("This is a much longer line that might cause memory issues if copied inefficiently")
local new_line_count = buffer.length()
local new_memory = new_line_count * 20
local memory_growth = new_memory - old_memory
me.console.log("📊 Memory growth: " + old_memory + " -> " + new_memory + " (+"+memory_growth+")")
if (memory_growth > 100) {
me.console.log("⚠️ Large memory growth detected! Possible inefficient copy")
} else {
me.console.log("✅ Memory growth within normal range")
}
// Test 4: Operation counting
local operation_count = 3 // We did 3 push operations
local memory_per_op = new_memory / operation_count
me.console.log("📈 Average memory per operation: " + memory_per_op + " bytes")
me.console.log("🎉 Phase 10 Kilo memory efficiency test complete!")
return "Kilo memory test finished"
}
}