Variety of speed ups for parsing mappings#186
Merged
fitzgen merged 5 commits intomozilla:masterfrom Jun 26, 2015
Merged
Conversation
Contributor
There was a problem hiding this comment.
This seems like it would be race condition prone, since the results are timing dependent. Is there a better way to warm up the JIT, that does not suffer from timing effects?
Contributor
Author
There was a problem hiding this comment.
Unfortunately, because each parse takes so long, we can't just run it n times before measuring, and I don't think there is a better way.
Contributor
|
Patch looks good to me. r+ These are great improvements. It's quite fun how we're scraping the barrel of JS performance with this library :-) |
It turns out that some (most?) JavaScript engines don't self-host `Array.prototype.sort`. This makes sense because C++ will likely remain faster than JS when doing raw CPU-intensive sorting. However, when using a custom comparator function, calling back and forth between the VM's C++ and JIT'd JS is rather slow *and* loses JIT type information, resulting in worse generated code for the comparator function than would be optimal. In fact, when sorting with a comparator, these costs outweigh the benefits of sorting in C++. By using our own JS-implemented Quick Sort (below), we get a ~3500ms mean speed-up in `bench/bench.html`.
fitzgen
added a commit
that referenced
this pull request
Jun 26, 2015
Variety of speed ups for parsing mappings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This builds on top of #185
This is a variety of speed ups to parsing mappings. Most notable is rolling our own sorting in JS. See
source-map/lib/source-map/quick-sort.js
Lines 12 to 20 in a0f0ff8
r? @ejpbruel