Quantcast
Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

New Post: Global window object

$
0
0
Hi AndersBillLinden,

I meant DOM implementation that uses clearscript.

We aren't aware of one, but we would hope that any existing .NET implementation of the DOM would be easy to expose via ClearScript.

But that is what browsers do, I presume. How can it be more expensive than exposing host methods?

When support for HostItemFlags.GlobalMembers is enabled (as it is by default), V8 calls back to the host for all global property access, such as when a script reads or writes a global variable, or retrieves a JavaScript built-in such as Math, String, Function, etc.

When V8ScriptEngineFlags.DisableGlobalMembers is in effect, this doesn't happen. Global properties are read and written without the host's involvement. Obviously if the global property is a host object, then accessing its members still involves the host, but retrieving a reference to the host object itself does not.

With recent efforts to make JavaScript code more modular and less reliant on global data, the impact may be reduced, but ClearScriptBenchmarks clearly shows that disabling support for HostItemFlags.GlobalMembers makes a huge difference for SunSpider performance.

Good luck!

Viewing all articles
Browse latest Browse all 2297

Trending Articles