refactor: No normalized path interning - #375
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #375 +/- ##
==========================================
- Coverage 92.74% 92.72% -0.02%
==========================================
Files 110 110
Lines 4687 4702 +15
Branches 2373 2380 +7
==========================================
+ Hits 4347 4360 +13
- Misses 340 342 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
NormalizedPath drops the interned cache and hence the caching strategy can no longer be set via the static NormalizedPath.interned property. Cache (and LruCache/NoCache) stay for static_handler.
- fromUri reuses the unmodifiable Uri.pathSegments list when the path needs no normalization. - Precompute each parameter Symbol at registration instead of per lookup. - _lookupRecursive threads one mutable params map with undo on backtrack instead of copying it at each level.
4365a02 to
c4cba4d
Compare
c4cba4d to
deaad11
Compare
Also drops the assertion that lookup results are not memoized, which is still a valid future optimization.
e2007fb to
d840b0d
Compare
Description
Remove NormalizedPath interning
This PR removes NormalizedPath interning completely.
Interning was originally added to avoid re-normalizing paths, but it always had two problems:
On top of that, the new
NormalizedPath.fromSegmentsandNormalizedPath.fromUriconstructors - now the ones actually used on the request path - made interning tricky, so the security PRs (#369 & #371) simply skipped it for those paths.Most of the lost performance is recouped by:
Inferring from the registered routes whether backtracking is needed at all, and taking a faster non-backtracking walk when it isn't.Results
Fixes: #118 (not by improving caching, but by dropping it)
Fixes: #342 (this time by disabling interning altogether, instead of making caching opt-out)
Closes: #344 (investigation done)
Breaking changes
NormalizedPath.internedis removed