Bug 20718

Summary: Cache the code generated for eval to speed up SunSpider and web sites
Product: WebKit Reporter: Maciej Stachowiak <mjs>
Component: WebCore JavaScriptAssignee: Maciej Stachowiak <mjs>
Status: RESOLVED FIXED    
Severity: Normal CC: eric, oliver, zwarich
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Mac   
OS: OS X 10.5   
Attachments:
Description Flags
add an eval code cache andersca: review+

Maciej Stachowiak
Reported 2008-09-08 04:05:34 PDT
The date-format-tofte test could benefit from an eval code cache, whereby code for the same string eval'd in the same context is retained so that repeated evals can skip parsing and compilation. Bleeding-edge V8 includes a similar idea. It turns out that real sites benefit from this as well. Google spreadsheets, GMail, Slate and Digg all get hits on this cache, between 2 and 100 depending on the site. I also tested that in the miss case there is no measurable slowdown.
Attachments
add an eval code cache (10.20 KB, patch)
2008-09-08 04:17 PDT, Maciej Stachowiak
andersca: review+
Maciej Stachowiak
Comment 1 2008-09-08 04:17:10 PDT
Created attachment 23247 [details] add an eval code cache
Maciej Stachowiak
Comment 2 2008-09-08 04:19:13 PDT
The attached patch is a 1.052x speedup on SunSpider relative to trunk.
Anders Carlsson
Comment 3 2008-09-08 04:28:57 PDT
Comment on attachment 23247 [details] add an eval code cache >\ No newline at end of file Should add a newline here. r=me
Geoffrey Garen
Comment 4 2008-09-08 09:46:00 PDT
Why not make the cache per global object? That would save memory in the case of a lot of functions doing similar evals.
Note You need to log in before you can comment on or make changes to this bug.