-
-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
get_last_nested() used to walk the entire list, requiring linear time. Because get_last_nested() is also invoked a linear amount of times, this leads to an overall quadratic running time in order to access all nested buffers. This effect is called 'accidentally quadratic', and is a common issue. The 'Can quickly handle deeply nested buffer' test makes sure that this issue does not regress in the future, and also allows me to make some guesstimates about the performance gain: For a nesting depth of 30000, the test is sped up from 4 seconds to less than 0.01 seconds. Here are some more practical numbers: Iterating over the entire planet (which has very large blocks and thus deeply nested buffers), I observe a speed up from 163.1 s to 160.9 s according to hyperfine (10 runs each).
- Loading branch information
1 parent
9537db0
commit 4a12e27
Showing
2 changed files
with
127 additions
and
6 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
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