98deb8f3fe
The `eval` and `eval_observed` methods in the `VM` struct were very similar, with the primary difference being the call to the `VMObserver` trait. This commit refactors these methods into a single macro, `dispatch_eval!`, which reduces code duplication and improves maintainability. The `Value::TailCallRequest` variant was also updated to use `Box` for its contents, which helps keep the `Value` enum size consistent. Finally, the benchmarks in the `examples` directory have been updated to reflect minor performance changes resulting from these code modifications.
20 lines
327 B
Plaintext
20 lines
327 B
Plaintext
;; Complex Data Structure Test
|
|
;; Benchmark: 64.4us
|
|
;; Output: {:input 10, :name "Fibonacci", :output 55}
|
|
(do
|
|
(def fib (fn [n]
|
|
(if (< n 2)
|
|
n
|
|
(+ (fib (- n 1)) (fib (- n 2))))))
|
|
|
|
(def result (fib 10))
|
|
|
|
(def data {
|
|
:name "Fibonacci"
|
|
:input 10
|
|
:output result
|
|
})
|
|
|
|
data
|
|
)
|