Bug 113446 - cache parsed interfaces in CodeGenerator.pm
Summary: cache parsed interfaces in CodeGenerator.pm
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore JavaScript (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: arno.
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-27 14:52 PDT by arno.
Modified: 2013-03-27 17:37 PDT (History)
6 users (show)

See Also:


Attachments
script used to benchmark binding generations (1.66 KB, application/x-shellscript)
2013-03-27 15:31 PDT, arno.
no flags Details
patch proposal (2.50 KB, patch)
2013-03-27 15:35 PDT, arno.
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description arno. 2013-03-27 14:52:37 PDT
Hi,
when generating a javascript binding for an interface, it is sometimes necessary to parse some another interfaces, namely its parents interfaces.
Informations about the parents bindings may be needed multiple times. So we end end parsing several times the same interface. But caching the parsing result, we could speedup binding generations.
Comment 1 Kentaro Hara 2013-03-27 14:55:45 PDT
Sounds reasonable.

Did you observe any performance issue caused by the redundant parsing? (I'm just curious about it because parent chains wouldn't be long in most cases.)
Comment 2 arno. 2013-03-27 15:31:49 PDT
Created attachment 195414 [details]
script used to benchmark binding generations

(In reply to comment #1)
> Sounds reasonable.
> 
> Did you observe any performance issue caused by the redundant parsing? (I'm just curious about it because parent chains wouldn't be long in most cases.)


I definitively see an improvement by caching the results.
I used the attached script, launched from WebKitBuild/Release/ to benchmark generate-bindings.pl

When running it on all the WebCore idls, it take me 
3'40" for JavascriptCore and about 13' for V8
With caching, it takes me about 2'10" for both.

(I ran the tests several times to avoid cold cache bias)
Comment 3 Kentaro Hara 2013-03-27 15:32:33 PDT
Great!
Comment 4 arno. 2013-03-27 15:35:57 PDT
Created attachment 195416 [details]
patch proposal
Comment 5 Kentaro Hara 2013-03-27 15:53:32 PDT
Comment on attachment 195416 [details]
patch proposal

Looks good. Feel free to set r?.
Comment 6 Kentaro Hara 2013-03-27 15:55:31 PDT
Comment on attachment 195416 [details]
patch proposal

Thanks!
Comment 7 WebKit Review Bot 2013-03-27 17:37:38 PDT
Comment on attachment 195416 [details]
patch proposal

Clearing flags on attachment: 195416

Committed r147037: <http://trac.webkit.org/changeset/147037>
Comment 8 WebKit Review Bot 2013-03-27 17:37:41 PDT
All reviewed patches have been landed.  Closing bug.