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.
Currently, all runs in each benchmark test use the same resolver instance, which has a built-in cache. As a result, except for the first run, all subsequent runs hit the cache and execute significantly faster. This causes the benchmark results to fail to accurately reflect its performance.
rspack-resolver/benches/resolver.rs
Lines 158 to 165 in e3d5975
Here are the benchmark results from the main branch:
If we create a new resolver instance in each run, the benchmark results will look like this:
(branch: nilptr/fix/bench-without-cache)
Since we want to compare the performance with async fs version, I feel it's better to fix the benchmarks first.
Also, as we need to use Tokio as the async runtime, it would be better to start switching to Tokio as the multi-thread runner. This will make it easier for us to make comparisons.
Finally, I added a multi-threaded version of the "resolve from symlinks" benchmark case, which better demonstrates the potential of async fs.
Here are the benchmark results from the source branch:
The multi-thread benchmark case takes twice as long, while the others remain mostly unchanged. Probably because Tokio's scheduling strategy is not as efficient as Rayon’s.