embind currently generates the following glue code for accessing the global
object:
function emval_get_global() { return (function(){
return Function;
})()('return this')(); }
This function is called every time we access emscripten::val::global() from
C++, e.g.
val Object = val::global("Object");
It turns out it's pretty slow in SpiderMonkey - running this function in a
loop 10,000 times we see that it takes on average 117 ms in SpiderMonkey
compared to 17 ms in V8.
I shall raise this slowness issue with SpiderMonkey separately, but I am
wondering if there is room for improvement here on the emscripten side as
well - for example, would it make sense to cache this value, or make use of
the new globalThis
<https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis>
instead?
--
You received this message because you are subscribed to the Google Groups
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/emscripten-discuss/ccb15dab-24c7-4f08-b28c-dd4f26d013e0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.