Repository navigation
Do not scan to the end for each new state spread through a list - #50
Merged
Merged
Conversation
A carrier that comes back in the antenna sample brings its cells all over the list. compare scanned the rest of the last list for each of them, and toggling carriers in a row held the main thread for 3 to 10 s on an iPad Pro. Once it has scanned as many states as the last list has, it now looks objects up in an index of that list.
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.
Fixes a main-thread freeze introduced in #49. Toggling carriers one after another in the antenna sample (723,800 circles) stopped the main thread for 3 to 10 s.
Why
AddProgressTracker.comparewalks the next list against the last one, and looks up to 64 states ahead for each object. Past that, it scanned on to the end of the last list.What
The walk scans past the window until it has scanned as many states as the last list has. After that, it looks objects up in an index of the last list, keyed by
ObjectIdentifierand built once. The cost stays linear in the list size.One test added: 20,000 new states spread through a 60,000-state list. It passes; with the old scan put back, it fails. All 579 tests pass.
Checked
On an iPad Pro 11-inch with Google Maps, Release build: 20 taps across the four carriers, about 0.8 s apart, without waiting for the app to go idle.
After the taps, the sample shows all 723,800 circles and the drawing overlay is gone.