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:
Bob Nystrom
2015-12-24 01:29:53 +00:00
parent 5865f534fc
commit 51bc3a828c
6 changed files with 76 additions and 3 deletions
+9
View File
@@ -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)")