WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED INVALID
99634
[v8] IntegerCache should be removed in favor of a faster v8 API
https://bugs.webkit.org/show_bug.cgi?id=99634
Summary
[v8] IntegerCache should be removed in favor of a faster v8 API
Eric Seidel (no email)
Reported
2012-10-17 13:52:57 PDT
[v8] IntegerCache is redundant with V8's SMI support and should be removed It looks like we'd just need to create a version of Integer::New() which is inlined, and can take an Isolate pointer. Then we would have exactly the same branch cost as our current IntegerCache implementation, without the extra code. :) We'd also then be faster on all integers up to the SMI limit, instead of const int numberOfCachedSmallIntegers = 64;
Attachments
Patch for benchmarking
(1.04 KB, patch)
2012-10-17 17:56 PDT
,
Adam Barth
no flags
Details
Formatted Diff
Diff
PerformanceTest results (first three are with patch; last three are without patch)
(27.75 KB, text/html)
2012-10-17 17:57 PDT
,
Adam Barth
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Adam Barth
Comment 1
2012-10-17 13:53:51 PDT
We need to add a new V8 API for creating integers quickly.
Adam Barth
Comment 2
2012-10-17 14:01:36 PDT
The problem is more that v8::Integer::New needs to grab the isolate out of thread-local storage. In any case, we should fix this by improving the V8 API.
Adam Barth
Comment 3
2012-10-17 14:36:29 PDT
V8 change is in <
https://codereview.chromium.org/11212004/
>. I haven't benchmarked the new API to know whether it is fast enough for our purposes. @haraken, would you be willing to run the same benchmark you ran when you introduced the IntegerCache?
Kentaro Hara
Comment 4
2012-10-17 17:07:10 PDT
(In reply to
comment #2
)
> The problem is more that v8::Integer::New needs to grab the isolate out of thread-local storage. In any case, we should fix this by improving the V8
When I was investigating the performance, another problem was the overhead to create a local handle for a cached persistent handle of SMIs. Given that V8 APIs needs to be general, V8 APIs cannot avoid creating local handles every time. On the other hand, by caching the persistent handles in the V8 binding side, we can avoid creating local handles and just return the cached persistent handles (because V8 binding knows the lifetime of Workers and their persistent handles). (In reply to
comment #3
)
> V8 change is in <
https://codereview.chromium.org/11212004/
>. I haven't benchmarked the new API to know whether it is fast enough for our purposes. > > @haraken, would you be willing to run the same benchmark you ran when you introduced the IntegerCache?
The benchmark is Bindings/scroll-top.html
Adam Barth
Comment 5
2012-10-17 17:44:32 PDT
> The benchmark is Bindings/scroll-top.html
Thanks. I'll try that now.
Adam Barth
Comment 6
2012-10-17 17:56:27 PDT
Created
attachment 169316
[details]
Patch for benchmarking
Adam Barth
Comment 7
2012-10-17 17:57:42 PDT
Created
attachment 169317
[details]
PerformanceTest results (first three are with patch; last three are without patch) Looks like about a 5% slow down on this benchmark. It's a bit hard to tell because this machine is noisy for benchmarks. I might try benchmarking it again on a more stable machine.
Adam Barth
Comment 8
2012-10-17 18:01:55 PDT
For fun, I ran the benchmark with the old v8::Integer::New API, and the new API is definitely faster, just not as fast as having the integer cache.
Kentaro Hara
Comment 9
2012-10-17 18:03:58 PDT
(In reply to
comment #8
)
> For fun, I ran the benchmark with the old v8::Integer::New API, and the new API is definitely faster, just not as fast as having the integer cache.
I would guess that the new API is still consuming time on creating a local handle by Utils::IntegerToLocal(result), which is not needed in the IntegerCache.
Adam Barth
Comment 10
2012-10-17 18:07:16 PDT
> I would guess that the new API is still consuming time on creating a local handle by Utils::IntegerToLocal(result), which is not needed in the IntegerCache.
What takes the time here? #define MAKE_TO_LOCAL(Name, From, To) \ Local<v8::To> Utils::Name(v8::internal::Handle<v8::internal::From> obj) { \ ASSERT(obj.is_null() || !obj->IsTheHole()); \ return Local<To>(reinterpret_cast<To*>(obj.location())); \ } I don't see a call to Local::New there.
Kentaro Hara
Comment 11
2012-10-17 18:16:07 PDT
(In reply to
comment #10
)
> What takes the time here? > > #define MAKE_TO_LOCAL(Name, From, To) \ > Local<v8::To> Utils::Name(v8::internal::Handle<v8::internal::From> obj) { \ > ASSERT(obj.is_null() || !obj->IsTheHole()); \ > return Local<To>(reinterpret_cast<To*>(obj.location())); \ > } > > I don't see a call to Local::New there.
hmm, that's true...
Adam Barth
Comment 12
2012-10-17 18:29:19 PDT
I think I just need to benchmark this stuff on a more performance-stable machine.
Adam Barth
Comment 13
2012-10-18 16:47:23 PDT
I benchmarked this on a more performance-stable machine, and the faster API isn't fast enough.
Adam Barth
Comment 14
2012-10-22 15:42:03 PDT
Bug 100016
is a follow up to this bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug