Update benchmark metadata

This commit updates the benchmark metadata in several example files. The
benchmark runs and repeat counts have been slightly adjusted due to
optimizations or minor variations in execution.
This commit is contained in:
Michael Schimmel
2026-02-22 01:37:00 +01:00
parent e87f7232e6
commit 0ed52a811d
25 changed files with 92 additions and 62 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
;; Closure Scope Test ;; Closure Scope Test
;; Benchmark: 777ns ;; Benchmark: 779ns
;; Benchmark-Repeat: 2659 ;; Benchmark-Repeat: 2613
;; Output: 15 ;; Output: 15
(do (do
(def make-adder (fn [x] (def make-adder (fn [x]
+2
View File
@@ -1,2 +1,4 @@
;; Benchmark: 143ns
;; Benchmark-Repeat: 14093
;; Output: 5 ;; Output: 5
(((fn [x] (fn [] x)) 5)) (((fn [x] (fn [] x)) 5))
+2
View File
@@ -1,3 +1,5 @@
;; Benchmark: 620ns
;; Benchmark-Repeat: 3234
;; Output: 5 ;; Output: 5
(do (do
(def f (fn [x] (fn [] x))) (def f (fn [x] (fn [] x)))
+2
View File
@@ -1,3 +1,5 @@
;; Benchmark: 1.1us
;; Benchmark-Repeat: 1848
;; Output: 42 ;; Output: 42
(do (do
(def f (fn [a] (fn [b] (fn [c] (+ a (+ b c)))))) (def f (fn [a] (fn [b] (fn [c] (+ a (+ b c))))))
+1 -1
View File
@@ -1,5 +1,5 @@
;; Complex Data Structure Test ;; Complex Data Structure Test
;; Benchmark: 53.1us ;; Benchmark: 53.6us
;; Benchmark-Repeat: 39 ;; Benchmark-Repeat: 39
;; Output: {:name "Fibonacci", :input 10, :output 55} ;; Output: {:name "Fibonacci", :input 10, :output 55}
(do (do
+2
View File
@@ -1,3 +1,5 @@
;; Benchmark: 363ns
;; Benchmark-Repeat: 5561
;; examples/def_local_inlining.myc ;; examples/def_local_inlining.myc
;; Demonstrates potential for DefLocal-Inlining (Phase 2.5) ;; Demonstrates potential for DefLocal-Inlining (Phase 2.5)
+2 -2
View File
@@ -1,5 +1,5 @@
;; Benchmark: 2.3us ;; Benchmark: 2.4us
;; Benchmark-Repeat: 880 ;; Benchmark-Repeat: 848
;; Comprehensive Destructuring Test ;; Comprehensive Destructuring Test
;; Covers: Nested tuples, mixed params, dynamic passing ;; Covers: Nested tuples, mixed params, dynamic passing
+2 -2
View File
@@ -1,5 +1,5 @@
;; Benchmark: 1.7us ;; Benchmark: 1.4us
;; Benchmark-Repeat: 1198 ;; Benchmark-Repeat: 1448
;; Output: 36 ;; Output: 36
(do (do
;; Excessive capture test ;; Excessive capture test
+2 -2
View File
@@ -1,6 +1,6 @@
;; Fibonacci Recursive ;; Fibonacci Recursive
;; Benchmark: 52.5us ;; Benchmark: 53.7us
;; Benchmark-Repeat: 38 ;; Benchmark-Repeat: 39
;; Output: 55 ;; Output: 55
(do (do
(def fib (fn [n] (def fib (fn [n]
+2
View File
@@ -1,2 +1,4 @@
;; Benchmark: 143ns
;; Benchmark-Repeat: 14112
;; Output: 30 ;; Output: 30
(+ 10 20) (+ 10 20)
+2 -2
View File
@@ -1,6 +1,6 @@
;; Higher-Order Function Example ;; Higher-Order Function Example
;; Benchmark: 680ns ;; Benchmark: 706ns
;; Benchmark-Repeat: 2981 ;; Benchmark-Repeat: 2798
;; Output: 25 ;; Output: 25
(do (do
(def apply (fn [f x] (f x))) (def apply (fn [f x] (f x)))
+2 -2
View File
@@ -1,5 +1,5 @@
;; Benchmark: 462ns ;; Benchmark: 354ns
;; Benchmark-Repeat: 4348 ;; Benchmark-Repeat: 5640
;; Financial DSL Macro example ;; Financial DSL Macro example
;; Demonstrates generating complex records from simple parameters. ;; Demonstrates generating complex records from simple parameters.
;; Output: {:price 100, :size 2, :total 200} ;; Output: {:price 100, :size 2, :total 200}
+2 -2
View File
@@ -1,5 +1,5 @@
;; Benchmark: 350ns ;; Benchmark: 339ns
;; Benchmark-Repeat: 5767 ;; Benchmark-Repeat: 6100
;; Output: 5 ;; Output: 5
(do (do
(def y 1) (def y 1)
+2 -2
View File
@@ -1,5 +1,5 @@
;; Benchmark: 376ns ;; Benchmark: 217ns
;; Benchmark-Repeat: 5359 ;; Benchmark-Repeat: 9500
;; Nested Macro and Arithmetic example ;; Nested Macro and Arithmetic example
;; Output: 81 ;; Output: 81
+2 -2
View File
@@ -1,5 +1,5 @@
;; Benchmark: 277ns ;; Benchmark: 259ns
;; Benchmark-Repeat: 7185 ;; Benchmark-Repeat: 7947
;; Macro Splicing example ;; Macro Splicing example
;; Demonstrates unrolling a list into another list. ;; Demonstrates unrolling a list into another list.
;; Output: [0 1 2 3 4] ;; Output: [0 1 2 3 4]
+2 -2
View File
@@ -1,5 +1,5 @@
;; Benchmark: 177ns ;; Benchmark: 146ns
;; Benchmark-Repeat: 11587 ;; Benchmark-Repeat: 14044
;; Classic "unless" macro example ;; Classic "unless" macro example
;; Demonstrates simple template substitution. ;; Demonstrates simple template substitution.
;; Output: 42 ;; Output: 42
+2
View File
@@ -1,3 +1,5 @@
;; Benchmark: 503ns
;; Benchmark-Repeat: 3987
(do (do
(def PI 3.1415) (def PI 3.1415)
(def area (fn [x] (* PI x))) (def area (fn [x] (* PI x)))
+2 -2
View File
@@ -1,7 +1,7 @@
;; Record to Tuple Mapping Test ;; Record to Tuple Mapping Test
;; Output: 30 ;; Output: 30
;; Benchmark: 743ns ;; Benchmark: 760ns
;; Benchmark-Repeat: 2733 ;; Benchmark-Repeat: 2612
(do (do
(def rec {:x 10 :y 20}) (def rec {:x 10 :y 20})
+2 -2
View File
@@ -2,8 +2,8 @@
;; This test calls a function that destructures a record ;; This test calls a function that destructures a record
;; Current implementation is now zero-allocation for destructuring. ;; Current implementation is now zero-allocation for destructuring.
;; Output: 3 ;; Output: 3
;; Benchmark: 723ns ;; Benchmark: 740ns
;; Benchmark-Repeat: 2783 ;; Benchmark-Repeat: 2745
(do (do
(def process (fn [[x y]] (def process (fn [[x y]]
+2 -2
View File
@@ -2,8 +2,8 @@
;; heavily recursive, benefits significantly from specialization of integer arithmetic ;; heavily recursive, benefits significantly from specialization of integer arithmetic
;; and direct function calls (skipping dynamic dispatch). ;; and direct function calls (skipping dynamic dispatch).
;; Output: 5 ;; Output: 5
;; Benchmark: 471.9us ;; Benchmark: 488.0us
;; Benchmark-Repeat: 5 ;; Benchmark-Repeat: 5
(do (do
+1 -1
View File
@@ -1,4 +1,4 @@
;; Benchmark: 2.7ms ;; Benchmark: 2.9ms
;; Output: "done" ;; Output: "done"
(do (do
(def count_down (fn [n] (def count_down (fn [n]
+1 -1
View File
@@ -1,5 +1,5 @@
;; Benchmark: 1.9us ;; Benchmark: 1.9us
;; Benchmark-Repeat: 1061 ;; Benchmark-Repeat: 1043
;; Demonstration of N-dimensional Tuples, Vectors, and Matrices ;; Demonstration of N-dimensional Tuples, Vectors, and Matrices
;; Based on docs/Tupel 1.md ;; Based on docs/Tupel 1.md
;; ;;
@@ -1,9 +1,14 @@
--- ---
source: src/ast/compiler/optimizer.rs source: src/ast/compiler/optimizer.rs
assertion_line: 533 assertion_line: 720
expression: dump expression: dump
--- ---
Lambda (Upvalues: 0) <Metadata: Metadata { ty: Function(Signature { params: Tuple([]), ret: Int }), is_tail: true }> Lambda (Upvalues: 0) <Metadata: Metadata { ty: Function(Signature { params: Tuple([]), ret: Int }), is_tail: true }>
Parameters: Parameters:
Tuple <Metadata: Metadata { ty: Tuple([]), is_tail: false }> Tuple <Metadata: Metadata { ty: Tuple([]), is_tail: false }>
Constant: 20 <Metadata: Metadata { ty: Int, is_tail: true }> Block <Metadata: Metadata { ty: Int, is_tail: true }>
DefLocal (Name: 'x', Slot: 0, not captured) <Metadata: Metadata { ty: Int, is_tail: false }>
Constant: 10 <Metadata: Metadata { ty: Int, is_tail: false }>
Set: Local(0) <Metadata: Metadata { ty: Int, is_tail: false }>
Constant: 20 <Metadata: Metadata { ty: Int, is_tail: false }>
Constant: 20 <Metadata: Metadata { ty: Int, is_tail: true }>
@@ -1,16 +1,12 @@
--- ---
source: src/ast/compiler/optimizer.rs source: src/ast/compiler/optimizer.rs
assertion_line: 540 assertion_line: 727
expression: dump expression: dump
--- ---
Lambda (Upvalues: 0) <Metadata: Metadata { ty: Function(Signature { params: Tuple([]), ret: Function(Signature { params: Tuple([]), ret: Int }) }), is_tail: true }> Lambda (Upvalues: 0) <Metadata: Metadata { ty: Function(Signature { params: Tuple([]), ret: Function(Signature { params: Tuple([]), ret: Int }) }), is_tail: true }>
Parameters: Parameters:
Tuple <Metadata: Metadata { ty: Tuple([]), is_tail: false }> Tuple <Metadata: Metadata { ty: Tuple([]), is_tail: false }>
Block <Metadata: Metadata { ty: Function(Signature { params: Tuple([]), ret: Int }), is_tail: true }> Lambda (Upvalues: 0) <Metadata: Metadata { ty: Function(Signature { params: Tuple([]), ret: Int }), is_tail: true }>
DefLocal (Name: 'x', Slot: 0, captured by 1 lambdas) <Metadata: Metadata { ty: Int, is_tail: false }> Parameters:
- Capturer: Lambda at line 1, col 23 Tuple <Metadata: Metadata { ty: Tuple([]), is_tail: false }>
Constant: 10 <Metadata: Metadata { ty: Int, is_tail: false }> Constant: 10 <Metadata: Metadata { ty: Int, is_tail: true }>
Lambda (Upvalues: 0) <Metadata: Metadata { ty: Function(Signature { params: Tuple([]), ret: Int }), is_tail: true }>
Parameters:
Tuple <Metadata: Metadata { ty: Tuple([]), is_tail: false }>
Constant: 10 <Metadata: Metadata { ty: Int, is_tail: true }>
+26 -9
View File
@@ -1,9 +1,9 @@
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use crate::ast::environment::Environment;
use crate::ast::nodes::UntypedKind;
use crate::ast::parser::Parser; use crate::ast::parser::Parser;
use crate::ast::types::Value; use crate::ast::types::Value;
use crate::ast::nodes::UntypedKind;
use crate::ast::environment::Environment;
#[test] #[test]
fn test_parse_integer_constant() { fn test_parse_integer_constant() {
@@ -85,14 +85,19 @@ mod tests {
for level in 0..=2 { for level in 0..=2 {
let results = crate::utils::tester::run_functional_tests_with_level(level); let results = crate::utils::tester::run_functional_tests_with_level(level);
for res in results { for res in results {
assert!(res.success, "Example {} failed at level {}: {}", res.name, level, res.message); assert!(
res.success,
"Example {} failed at level {}: {}",
res.name, level, res.message
);
} }
} }
} }
#[test] #[test]
fn test_debug_mode_logging() { fn test_debug_mode_logging() {
let env = Environment::new(); let mut env = Environment::new();
env.optimization_level = 0;
let source = "(+ 10 20)"; let source = "(+ 10 20)";
let result = env.run_debug(source).expect("Failed to run debug"); let result = env.run_debug(source).expect("Failed to run debug");
@@ -130,10 +135,22 @@ mod tests {
assert_eq!(format!("{}", env.run_script("(% 20 3)").unwrap()), "2"); // 20 % 3 = 2 assert_eq!(format!("{}", env.run_script("(% 20 3)").unwrap()), "2"); // 20 % 3 = 2
// --- Logic / Bitwise --- // --- Logic / Bitwise ---
assert_eq!(format!("{}", env.run_script("(and true false)").unwrap()), "false"); assert_eq!(
assert_eq!(format!("{}", env.run_script("(or true false)").unwrap()), "true"); format!("{}", env.run_script("(and true false)").unwrap()),
assert_eq!(format!("{}", env.run_script("(xor true false)").unwrap()), "true"); "false"
assert_eq!(format!("{}", env.run_script("(not true)").unwrap()), "false"); );
assert_eq!(
format!("{}", env.run_script("(or true false)").unwrap()),
"true"
);
assert_eq!(
format!("{}", env.run_script("(xor true false)").unwrap()),
"true"
);
assert_eq!(
format!("{}", env.run_script("(not true)").unwrap()),
"false"
);
assert_eq!(format!("{}", env.run_script("(<< 1 2)").unwrap()), "4"); // 1 << 2 = 4 assert_eq!(format!("{}", env.run_script("(<< 1 2)").unwrap()), "4"); // 1 << 2 = 4
assert_eq!(format!("{}", env.run_script("(>> 4 1)").unwrap()), "2"); // 4 >> 1 = 2 assert_eq!(format!("{}", env.run_script("(>> 4 1)").unwrap()), "2"); // 4 >> 1 = 2
@@ -174,7 +191,7 @@ mod tests {
let result = env.run_script(source); let result = env.run_script(source);
if let Err(e) = &result { if let Err(e) = &result {
panic!("Failed: {}", e); panic!("Failed: {}", e);
} }
assert_eq!(format!("{}", result.unwrap()), "60"); assert_eq!(format!("{}", result.unwrap()), "60");
} }