-
-
Notifications
You must be signed in to change notification settings - Fork 480
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf(sourcemap): improve perf of
search_original_line_and_column
(#…
…7926) this seems to show a decent speed up on perf. the thinking behind this change is: 1. subsequent calls to `search_original_line_and_column` will **never** look at back at lines it has already searched 2. binary search is faster in this case as typically `idx` is only increased by a small amount Given this, we can skip checking a bunch of lines (that will never return true) improving performance. This is a very hot path. ``` $ hyperfine --warmup=3 ./target/release-with-debug/examples/sourcemap-main ./target/release-with-debug/examples/sourcemap Benchmark 1: ./target/release-with-debug/examples/sourcemap-main Time (mean ± σ): 79.5 ms ± 5.5 ms [User: 65.1 ms, System: 12.2 ms] Range (min … max): 76.8 ms … 111.7 ms 37 runs Warning: Statistical outliers were detected. Consider re-running this benchmark on a quiet system without any interferences from other programs. It might help to use the '--warmup' or '--prepare' options. Benchmark 2: ./target/release-with-debug/examples/sourcemap Time (mean ± σ): 72.9 ms ± 0.9 ms [User: 59.2 ms, System: 12.2 ms] Range (min … max): 70.6 ms … 75.0 ms 40 runs Summary ./target/release-with-debug/examples/sourcemap ran 1.09 ± 0.08 times faster than ./target/release-with-debug/examples/sourcemap-main ``` --------- Co-authored-by: overlookmotel <[email protected]>
- Loading branch information
1 parent
f79e9ad
commit 78d2e83
Showing
1 changed file
with
157 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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