Bug 20718 - Cache the code generated for eval to speed up SunSpider and web sites
Summary: Cache the code generated for eval to speed up SunSpider and web sites
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore JavaScript (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.5
: P2 Normal
Assignee: Maciej Stachowiak
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-09-08 04:05 PDT by Maciej Stachowiak
Modified: 2008-09-08 09:46 PDT (History)
3 users (show)

See Also:


Attachments
add an eval code cache (10.20 KB, patch)
2008-09-08 04:17 PDT, Maciej Stachowiak
andersca: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Maciej Stachowiak 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.
Comment 1 Maciej Stachowiak 2008-09-08 04:17:10 PDT
Created attachment 23247 [details]
add an eval code cache
Comment 2 Maciej Stachowiak 2008-09-08 04:19:13 PDT
The attached patch is a 1.052x speedup on SunSpider relative to trunk.
Comment 3 Anders Carlsson 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
Comment 4 Geoffrey Garen 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.