Created attachment 164757 [details] Code does the binding through both JSC API and WebCore that demonstrates the performance. While using JSC API for JS binding, I found the performance is quite slow comparing to binding the same interface inside WebCore. I have attached a test file that adds a MyTest object that does doSqrt() inside WebCore and also hacks a doSqrt() in TestRunner in WebKitTestRunner. Run "WebKitBuild/Release/WebKitTestRunner LayoutTests/MyTest.html" shows that the latter is 7-8 times slower.
<rdar://problem/12339275>
Do you have any samples that might indicate where the time might be going?
Created attachment 165371 [details] Profiling result I did some profiling but didn't seem to find the bottleneck.
One thing I see here is that JSWrapper::unwrap unnecessarily checks for null and calls JSValueToObject. It should just ASSERT non-null and ASSERT JSValueIsObjectOfClass, since this is guaranteed by the code generator. Then, it should static_cast to JSObjectRef. This is not very important, since it's only test code, but if you're going to this piece of the test infrastructure for performance investigations, you should optimize it, so we don't get bogus results.