perf(router): improve performance of router
router performance improvements
Explicitly cached lengths, adjusted the order of evaluation of logical expressions, (without regexp router, for readability) and removed debugging properties to speed up and use other unique values. (trie-router)
The author should do the following, if applicable
Codecov Report
Attention: Patch coverage is 95.23810% with 5 lines in your changes missing coverage. Please review.
Project coverage is 94.31%. Comparing base (
90833d2) to head (1c681a9). Report is 9 commits behind head on main.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| src/router/linear-router/router.ts | 94.31% | 5 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## main #3526 +/- ##
==========================================
+ Coverage 94.29% 94.31% +0.01%
==========================================
Files 157 157
Lines 9488 9492 +4
Branches 2763 2779 +16
==========================================
+ Hits 8947 8952 +5
+ Misses 541 540 -1
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Hi @EdamAme-x, Thank you!
The performance difference between "for-of" and "for loop" is currently quite small (depending on the runtime), so I don't think it needs to be actively rewritten.
However, looking at the benchmarks for loops, it seems that "for loop" is still the fastest, so the changes in this pull request are reasonable 👍
@EdamAme-x
Thanks! I'll merge this now.