forked from Mirror/wren
I've got some ideas on how to tweak the embedding API, but I want to see what performance impact they have first, so this adds a little benchmark that just calls a foreign method a ton of times.
22 lines
480 B
C
22 lines
480 B
C
#include <string.h>
|
|
|
|
#include "benchmark.h"
|
|
|
|
static void arguments(WrenVM* vm)
|
|
{
|
|
double result = 0;
|
|
result += wrenGetArgumentDouble(vm, 1);
|
|
result += wrenGetArgumentDouble(vm, 2);
|
|
result += wrenGetArgumentDouble(vm, 3);
|
|
result += wrenGetArgumentDouble(vm, 4);
|
|
|
|
wrenReturnDouble(vm, result);
|
|
}
|
|
|
|
WrenForeignMethodFn benchmarkBindMethod(const char* signature)
|
|
{
|
|
if (strcmp(signature, "static Benchmark.arguments(_,_,_,_)") == 0) return arguments;
|
|
|
|
return NULL;
|
|
}
|