JS binding through JSC API is much slower than binding through WebCore
https://bugs.webkit.org/show_bug.cgi?id=97122
Summary JS binding through JSC API is much slower than binding through WebCore
Chang Shu
Reported 2012-09-19 11:08:16 PDT
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.
Attachments
Code does the binding through both JSC API and WebCore that demonstrates the performance. (8.60 KB, patch)
2012-09-19 11:08 PDT, Chang Shu
no flags
Profiling result (1.76 MB, application/x-tar)
2012-09-24 07:01 PDT, Chang Shu
no flags
Geoffrey Garen
Comment 1 2012-09-20 12:47:21 PDT
Sam Weinig
Comment 2 2012-09-23 00:07:04 PDT
Do you have any samples that might indicate where the time might be going?
Chang Shu
Comment 3 2012-09-24 07:01:14 PDT
Created attachment 165371 [details] Profiling result I did some profiling but didn't seem to find the bottleneck.
Geoffrey Garen
Comment 4 2013-07-11 14:33:33 PDT
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.
Note You need to log in before you can comment on or make changes to this bug.