diff --git a/.gitignore b/.gitignore index 4a5c7db..9c95797 100644 --- a/.gitignore +++ b/.gitignore @@ -83,3 +83,8 @@ site/ *.bc *.wasm test_compiler.py + +# Compiled binaries in examples (no extension) +examples/compiler/benchmarks/truthiness_test +examples/compiler/benchmarks/loop_fast +examples/compiler/benchmarks/fibonacci diff --git a/examples/compiler/benchmarks/loop_fast.eigs b/examples/compiler/benchmarks/loop_fast.eigs new file mode 100644 index 0000000..e6d244c --- /dev/null +++ b/examples/compiler/benchmarks/loop_fast.eigs @@ -0,0 +1,13 @@ +# Sum of 1 to 1,000,000 +# This is the ultimate test of scalar iteration speed +# Tests the Scalar Fast Path with while loops + +i is 0 +sum is 0 +limit is 1000000 + +loop while i < limit: + i is i + 1 + sum is sum + i + +print of sum diff --git a/examples/compiler/benchmarks/truthiness_test.eigs b/examples/compiler/benchmarks/truthiness_test.eigs new file mode 100644 index 0000000..55b39a7 --- /dev/null +++ b/examples/compiler/benchmarks/truthiness_test.eigs @@ -0,0 +1,14 @@ +# Test truthiness with scalar countdown +# This tests the ensure_bool() fix where a scalar is used directly as a condition +# Before the fix, this would crash with "cbranch expects i1, got double" + +count is 10 +sum is 0 + +# Using a scalar variable directly as a condition (not a comparison) +loop while count: + sum is sum + count + count is count - 1 + +print of sum +# Expected: 55 (10 + 9 + 8 + ... + 1)