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

Gatsby before/after #3

Open
KyleAMathews opened this issue Sep 19, 2016 · 9 comments
Open

Gatsby before/after #3

KyleAMathews opened this issue Sep 19, 2016 · 9 comments

Comments

@KyleAMathews
Copy link
Contributor

Couldn't really see any difference. There's a fair bit of variation on timing but the "long frame" time was around ~180ms for both with or without this plugin.

screen shot 2016-09-19 at 11 39 23 am
screen shot 2016-09-19 at 11 39 11 am

@TheLarkInn
Copy link
Owner

Interesting! It is supposed to help solve parse time. @nolanlawson can comment more on it.

@TheLarkInn
Copy link
Owner

I need to setup performance.mark() for debug mode for this plugin however I'm not sure what exactly to measure etc.

@nolanlawson
Copy link

You can use performance.mark() and .measure() if you want, but these are not supported in Safari.

I’d recommend just using:

var start = performance.now();
// code goes DIRECTLY here
var end = performance.now();
reportSomehow(end - start);

Also keep in mind that you would need to add a random query param to the end of the script URL if you want to run it multiple times and take the median/average, because otherwise the parsed/JITed result will be cached.

– Nolan

@nolanlawson
Copy link

Also FWIW this doesn't just affect V8; it also affects Chakra and SpiderMonkey. See: http://github.com/nolanlawson/optimize-js

@TheLarkInn
Copy link
Owner

My question is, where and what are you measuring. Where should the start measure go and where should the stop mark go. They answer will help me understand what the hell to look for.

@nolanlawson
Copy link

Whatever code you're trying to optimize, that's the code you should wrap in performance.now() measures. You can see how I modified the benchmark library files to see how to do this.

@TheLarkInn
Copy link
Owner

Ah thats true. I think we discovered the other browsers engaging in this sort of heuristic after I created the plugin. Ugh renaming things.

@addyosmani
Copy link

⏩ LazyParseWebpackPlugin

@TheLarkInn
Copy link
Owner

Lol yes I'm probably going to just change it to that

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

No branches or pull requests

4 participants