Skip to content
This repository has been archived by the owner on Dec 9, 2017. It is now read-only.

Improve performance of esnstrument #8

Open
msridhar opened this issue Nov 23, 2013 · 5 comments
Open

Improve performance of esnstrument #8

msridhar opened this issue Nov 23, 2013 · 5 comments

Comments

@msridhar
Copy link
Contributor

Right now, instrumenting code is a bit slow. I've put the v8 profiling output for instrumenting pdf.js here. One concerning thing is that ~20% of time is spent in GC; would have to dig in further to see why.

Otherwise, I don't see any quick fixes. The major change I can think of would be to not transform the AST and use escodegen, but instead generate the instrumented code string directly during the AST pass. Not sure how nightmare-ish this would be, though.

Other thoughts welcome :-)

@msridhar
Copy link
Contributor Author

Another thought was to generate code strings where convenient, cache them in the AST, and then modify escodegen to use cached strings when available. But, this would involve using a hacked version of escodegen.

@msridhar
Copy link
Contributor Author

One other tidbit: running with --trace_gc shows that the escodegen phase allocates a massive amount of memory: heap goes from ~200MB to between 500MB and 800MB for pdfjs. So somewhere it's allocating a ton of temporary objects.

@ksen007
Copy link
Contributor

ksen007 commented Nov 23, 2013

any idea if my traversals are also using massive amount of memory. 

Sent from Samsung Mobile

-------- Original message --------
From: Manu Sridharan [email protected]
Date: 23/11/2013 11:39 AM (GMT-08:00)
To: SRA-SiliconValley/jalangi [email protected]
Subject: Re: [jalangi] Improve performance of esnstrument (#8)

One other tidbit: running with --trace_gc shows that the escodegen phase allocates a massive amount of memory: heap goes from ~200MB to between 500MB and 800MB for pdfjs. So somewhere it's allocating a ton of temporary objects.


Reply to this email directly or view it on GitHub.

@msridhar
Copy link
Contributor Author

Doesn't look too bad from a GC trace. Will have to profile in the browser
and look at some heap snapshots to know better. But the mem usage from
escodegen is ridiculous.
On Nov 23, 2013 12:14 PM, "ksen007" [email protected] wrote:

any idea if my traversals are also using massive amount of memory.

Sent from Samsung Mobile

-------- Original message --------
From: Manu Sridharan [email protected]
Date: 23/11/2013 11:39 AM (GMT-08:00)
To: SRA-SiliconValley/jalangi [email protected]
Subject: Re: [jalangi] Improve performance of esnstrument (#8)

One other tidbit: running with --trace_gc shows that the escodegen phase
allocates a massive amount of memory: heap goes from ~200MB to between
500MB and 800MB for pdfjs. So somewhere it's allocating a ton of temporary
objects.


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHubhttps://github.com//issues/8#issuecomment-29140615
.

@msridhar
Copy link
Contributor Author

We got significant improvements by switching to acorn for parsing and patching a performance bug in escodegen. Will leave this open, as instrumentation is still a bit slow.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants