Repository navigation
Conversation
|
Comparing: edae846...a692d50 Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: (No significant changes) Generated by sizebot against a692d50 |
This branch has not been deployed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
LRUCache.get()shifted entries forward starting from the head when moving a hit to the front. That overwrote the slot right behind the head before it was read and then copied the old head into every following slot. The loop bound also used the raw array index instead of the distance from the head. So reading a cached file that wasn't the most recent one evicted other cached files, and with 10 entries the cache could drop to 2 unique files. Editors and watch mode that switch between files kept recompiling files that were already cached.This shifts backward from the hit to the head over the circular distance, so the other entries keep their order.
Fixes #38437
How did you test this change?
Added
LRUCache-test.js, covering a non-head hit, a hit across the end of the array, and LRU eviction order. All three fail before the change and pass after it.yarn workspace eslint-plugin-react-hooks testpasses.