optimize linked_list - #66
Open
chirizxc wants to merge 6 commits into
Open
Conversation
Owner
|
Thanks 🔥 |
Contributor
Author
|
I'll double-check all the |
Owner
|
Aha OK |
Owner
|
This implementation is really good. I checked it. But I think there's an issue We should remove the free list, or set a maximum length for it |
Contributor
Author
Yes, thanks |
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.
How do I view the diff after clicking the link? 🤔
TODO
Review
// SAFETYand// # Safetyagain, most of them were generated by AI, and we need to double-check that they are correctBenchmark
Results (about ~2.7-2.8 times faster):
❯ cargo bench -- lru_workload Finished `bench` profile [optimized] target(s) in 0.04s Running bench.rs (target\release\deps\bench-eb9d257623e7ec19.exe) Timer precision: 100 ns bench fastest │ slowest │ median │ mean │ samples │ iters ├─ pr_version │ │ │ │ │ │ ╰─ lru_workload 60.99 µs │ 129.8 µs │ 64.09 µs │ 67.2 µs │ 100 │ 100 │ 134.2 Mitem/s │ 63.06 Mitem/s │ 127.8 Mitem/s │ 121.8 Mitem/s │ │ ╰─ upstream │ │ │ │ │ ╰─ lru_workload 227 µs │ 513.8 µs │ 283.7 µs │ 302.8 µs │ 100 │ 100 36.07 Mitem/s │ 15.94 Mitem/s │ 28.86 Mitem/s │ 27.05 Mitem/s │ │ ❯ cargo bench -- lru_workload Finished `bench` profile [optimized] target(s) in 0.04s Running bench.rs (target\release\deps\bench-eb9d257623e7ec19.exe) Timer precision: 100 ns bench fastest │ slowest │ median │ mean │ samples │ iters ├─ pr_version │ │ │ │ │ │ ╰─ lru_workload 107.9 µs │ 179.9 µs │ 135.7 µs │ 135.8 µs │ 100 │ 100 │ 75.85 Mitem/s │ 45.51 Mitem/s │ 60.34 Mitem/s │ 60.28 Mitem/s │ │ ╰─ upstream │ │ │ │ │ ╰─ lru_workload 234.2 µs │ 437.5 µs │ 284.6 µs │ 292.9 µs │ 100 │ 100 34.96 Mitem/s │ 18.72 Mitem/s │ 28.77 Mitem/s │ 27.96 Mitem/s │ │ ❯ cargo bench -- lru_workload Finished `bench` profile [optimized] target(s) in 0.03s Running bench.rs (target\release\deps\bench-eb9d257623e7ec19.exe) Timer precision: 100 ns bench fastest │ slowest │ median │ mean │ samples │ iters ├─ pr_version │ │ │ │ │ │ ╰─ lru_workload 104.2 µs │ 139 µs │ 110.1 µs │ 112.1 µs │ 100 │ 100 │ 78.54 Mitem/s │ 58.89 Mitem/s │ 74.37 Mitem/s │ 73.01 Mitem/s │ │ ╰─ upstream │ │ │ │ │ ╰─ lru_workload 242.2 µs │ 599.2 µs │ 357.8 µs │ 362.1 µs │ 100 │ 100 33.8 Mitem/s │ 13.66 Mitem/s │ 22.89 Mitem/s │ 22.61 Mitem/s │ │ ❯ cargo bench -- lru_workload Finished `bench` profile [optimized] target(s) in 0.04s Running bench.rs (target\release\deps\bench-eb9d257623e7ec19.exe) Timer precision: 100 ns bench fastest │ slowest │ median │ mean │ samples │ iters ├─ pr_version │ │ │ │ │ │ ╰─ lru_workload 97.69 µs │ 134.8 µs │ 107.2 µs │ 108 µs │ 100 │ 100 │ 83.84 Mitem/s │ 60.72 Mitem/s │ 76.34 Mitem/s │ 75.84 Mitem/s │ │ ╰─ upstream │ │ │ │ │ ╰─ lru_workload 215.8 µs │ 489.6 µs │ 246.6 µs │ 288.1 µs │ 100 │ 100 37.94 Mitem/s │ 16.72 Mitem/s │ 33.2 Mitem/s │ 28.43 Mitem/s │ │