Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use createCachedData correctly #241

Merged
merged 1 commit into from
Jan 28, 2019
Merged

Conversation

sokra
Copy link
Member

@sokra sokra commented Jan 28, 2019

It need to be called after the script really ran.
v8 tracks type info while interpreting the script,
from these info compiled code is created.
Not executing functions doesn't track these info
and compiled code can't be created.

This change stores the new cached data everytime
the code runs, just before the process exit.
At time time most info is available.

This gives a 20%-30% performance boost for me

It need to be called after the script really ran.
v8 tracks type info while interpreting the script,
from these info compiled code is created.
Not executing functions doesn't track these info
and compiled code can't be created.

This change stores the new cached data everytime
the code runs, just before the process exit.
At time time most info is available.
@codecov-io
Copy link

Codecov Report

Merging #241 into master will not change coverage.
The diff coverage is 0%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #241   +/-   ##
=======================================
  Coverage   69.25%   69.25%           
=======================================
  Files          16       16           
  Lines         670      670           
=======================================
  Hits          464      464           
  Misses        206      206
Impacted Files Coverage Δ
src/index.js 68.79% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 19550a3...a72d5dc. Read the comment docs.

@rauchg rauchg merged commit 2915a8e into vercel:master Jan 28, 2019
@guybedford
Copy link
Contributor

Very cool, you've just invented the self-optimizing package :)

@guybedford
Copy link
Contributor

@sokra Im still reeling from this, this really is such a unique CS concept! A truly self-optimizing program. Profile-guided optimizing compilers be damned!

@guybedford
Copy link
Contributor

Also, in theory, since the cached optimization data is maintained transitively through every execution, there is also a convergence property in play here of optimizing the cached data over all executions thereby ending up with the best cache analysis, although that is depending on how v8 handles unused optimization data between runs.

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

Successfully merging this pull request may close these issues.

4 participants