feat: add wrenGetValueDouble API and benchmark for wrenCall() performance
Add a new public API function wrenGetValueDouble() to extract numeric values from WrenValue handles, with proper assertions for NULL and type checking. Introduce a comprehensive benchmark test for wrenCall() that measures invocation overhead by calling a foreign method 1,000,000 times across a separate VM instance, validating result correctness and reporting elapsed time. Include the benchmark script api_call.wren and register it in the Python benchmarking harness. Also fix minor assertion message typos in wren_vm.c for consistency.
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
class Benchmark {
|
||||
foreign static call(iterations)
|
||||
}
|
||||
|
||||
var result = Benchmark.call(1000000)
|
||||
// Returns false if it didn't calculate the right value. Otherwise returns the
|
||||
// elapsed time.
|
||||
System.print(result is Num)
|
||||
System.print("elapsed: %(result)")
|
||||
Reference in New Issue
Block a user