Hello!
You're already doing the right thing by using JSON to minimize hops across the .NET-V8 boundary.
Your next optimization might be to minimize your use of V8's JavaScript parser. To that end, consider wrapping
Then, simply do this:
This way you're using an efficient, dedicated JSON parser to convert your object instead of V8's general-purpose JavaScript parser, which is much more complex. Don't forget to cache and reuse
Good luck!
You're already doing the right thing by using JSON to minimize hops across the .NET-V8 boundary.
Your next optimization might be to minimize your use of V8's JavaScript parser. To that end, consider wrapping
someFunc
in a helper that takes a JSON string and converts it via the JSON object:dynamic someFuncHelper = Engine.Evaluate(@" (function (json) { return someFunc(JSON.parse(json)); }).valueOf() ");
// Engine.Evaluate("someFunc(" + json + ")");
someFuncHelper(json);
someFuncHelper
to avoid re-parsing and recompiling the wrapper.Good luck!