Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Unify worker module map transmission w/ small perf benefit. #8237
This PR unifies the way module maps are passed to the worker. Previously, we did it one way for watch mode and a different way for non-watch mode because our watch mode way was a lot slower.
I fixed that slowness for watch mode and realized while doing some performance and memory profiling that the watch mode way is now actually faster on a few levels:
Here's a benchmark of running
Time (mean ± σ): 3.902 s ± 0.120 s [User: 21.570 s, System: 5.105 s]
Time (mean ± σ): 3.522 s ± 0.175 s [User: 19.722 s, System: 4.777 s]
It's faster. It's less code with a unified code path. It opens up more optimizations in the future.
@@ Coverage Diff @@ ## master #8237 +/- ## ========================================== - Coverage 62.33% 62.28% -0.05% ========================================== Files 265 265 Lines 10553 10556 +3 Branches 2565 2563 -2 ========================================== - Hits 6578 6575 -3 - Misses 3387 3393 +6 Partials 588 588
The reason that we save the map to a file and read it from the worker is that I've found that on large module maps it used to take an insane amount of time to share it through workers. Doing it with two different implementations seemed like a good trade off. Before merging this, can you confirm this is actually faster on www and that it keeps scaling?
Benchmarked against 11 test files (all of which are just a single test with a single assertion) on WWW. Ran old vs. new 10 times each to get a decent profile.
This benchmarks 1.5% faster on average, which means that just this part is actually significantly faster since it's just a small part of the overall picture.