Add benchmark metadata to examples

This commit is contained in:
Michael Schimmel
2026-02-22 00:43:39 +01:00
parent e87f7232e6
commit 5790880002
10 changed files with 39 additions and 6 deletions
+2
View File
@@ -1,2 +1,4 @@
;; Benchmark: 148ns
;; Benchmark-Repeat: 13466
;; Output: 5
(((fn [x] (fn [] x)) 5))
+2
View File
@@ -1,3 +1,5 @@
;; Benchmark: 623ns
;; Benchmark-Repeat: 3201
;; Output: 5
(do
(def f (fn [x] (fn [] x)))
+2
View File
@@ -1,3 +1,5 @@
;; Benchmark: 1.1us
;; Benchmark-Repeat: 1814
;; Output: 42
(do
(def f (fn [a] (fn [b] (fn [c] (+ a (+ b c))))))
+2
View File
@@ -1,3 +1,5 @@
;; Benchmark: 374ns
;; Benchmark-Repeat: 5419
;; examples/def_local_inlining.myc
;; Demonstrates potential for DefLocal-Inlining (Phase 2.5)
+2 -2
View File
@@ -1,5 +1,5 @@
;; Benchmark: 1.7us
;; Benchmark-Repeat: 1198
;; Benchmark: 1.3us
;; Benchmark-Repeat: 1494
;; Output: 36
(do
;; Excessive capture test
+2
View File
@@ -1,2 +1,4 @@
;; Benchmark: 150ns
;; Benchmark-Repeat: 13074
;; Output: 30
(+ 10 20)
+2 -2
View File
@@ -1,5 +1,5 @@
;; Benchmark: 462ns
;; Benchmark-Repeat: 4348
;; Benchmark: 384ns
;; Benchmark-Repeat: 5255
;; Financial DSL Macro example
;; Demonstrates generating complex records from simple parameters.
;; Output: {:price 100, :size 2, :total 200}
+2 -2
View File
@@ -1,5 +1,5 @@
;; Benchmark: 376ns
;; Benchmark-Repeat: 5359
;; Benchmark: 223ns
;; Benchmark-Repeat: 8929
;; Nested Macro and Arithmetic example
;; Output: 81
+2
View File
@@ -1,3 +1,5 @@
;; Benchmark: 501ns
;; Benchmark-Repeat: 4038
(do
(def PI 3.1415)
(def area (fn [x] (* PI x)))
+21
View File
@@ -0,0 +1,21 @@
;; Benchmark: 666ns
;; Benchmark-Repeat: 2975
(do
;; 1. Provokation Stack-Gap (bei Optimization Level 2)
(def result
(fn []
(do
(def unused 10) ;; Wird entfernt, Slot 0 ist dann "leer"
(def used 42) ;; Bleibt auf Slot 1 -> Lücke!
used)))
;; 2. Provokation Inlining-Blockade
;; Diese Funktion wird nicht inlined, weil sie ein 'def' enthält
(def complex-add
(fn [a]
(do
(def b 100)
(+ a b))))
[(result) (complex-add 50)]
)