Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Entry API for storage2::LazyHashMap #480

Merged
merged 30 commits into from Sep 10, 2020

Conversation

cmichi
Copy link
Collaborator

@cmichi cmichi commented Jul 24, 2020

Closes #479.

Current benchmarks

Before HashMap was using the new LazyHashMap Entry API

$ cargo bench -- StorageHashMap 2>&1 | egrep " Compare|time" | egrep -v "Benchmarking|Warning"
StorageHashMap<i32, i32> Compare: `insert_and_inc` and `insert_and_inc_entry_api` (populated cache)/...
                        time:   [216.33 us 224.39 us 233.19 us]
StorageHashMap<i32, i32> Compare: `insert_and_inc` and `insert_and_inc_entry_api` (populated cache)/... #2
                        time:   [200.38 us 205.88 us 212.27 us]
StorageHashMap<i32, i32> Compare: `remove` and `remove_entry_api` (populated cache)/remove
                        time:   [140.09 us 147.61 us 156.13 us]
StorageHashMap<i32, i32> Compare: `remove` and `remove_entry_api` (populated cache)/remove_entry_api
                        time:   [134.15 us 137.28 us 140.45 us]
StorageHashMap<i32, i32> Compare: `insert_and_inc` and `insert_and_inc_entry_api` (empty cache)/inse...
                        time:   [609.94 us 622.39 us 635.53 us]
StorageHashMap<i32, i32> Compare: `insert_and_inc` and `insert_and_inc_entry_api` (empty cache)/inse... #2
                        time:   [704.19 us 729.47 us 755.61 us]
StorageHashMap<i32, i32> Compare: `remove` and `remove_entry_api` (empty cache)/remove
                        time:   [721.95 us 742.12 us 764.39 us]
StorageHashMap<i32, i32> Compare: `remove` and `remove_entry_api` (empty cache)/remove_entry_api
                        time:   [705.04 us 726.37 us 750.54 us]

Now that HashMap is using the new LazyHashMap Entry API

$ cargo bench -- StorageHashMap 2>&1 | egrep " Compare|time" | egrep -v "Benchmarking|Warning"
StorageHashMap<i32, i32> Compare: `insert_and_inc` and `insert_and_inc_entry_api` (populated cache)/...
                        time:   [205.43 us 209.77 us 215.22 us]
StorageHashMap<i32, i32> Compare: `insert_and_inc` and `insert_and_inc_entry_api` (populated cache)/... #2
                        time:   [117.55 us 118.76 us 120.20 us]
StorageHashMap<i32, i32> Compare: `remove` and `remove_entry_api` (populated cache)/remove
                        time:   [121.13 us 123.00 us 125.32 us]
StorageHashMap<i32, i32> Compare: `remove` and `remove_entry_api` (populated cache)/remove_entry_api
                        time:   [81.564 us 82.229 us 83.036 us]
StorageHashMap<i32, i32> Compare: `insert_and_inc` and `insert_and_inc_entry_api` (empty cache)/inse...
                        time:   [594.74 us 602.38 us 611.13 us]
StorageHashMap<i32, i32> Compare: `insert_and_inc` and `insert_and_inc_entry_api` (empty cache)/inse... #2
                        time:   [496.79 us 505.89 us 519.49 us]
StorageHashMap<i32, i32> Compare: `remove` and `remove_entry_api` (empty cache)/remove
                        time:   [611.75 us 629.06 us 651.67 us]
StorageHashMap<i32, i32> Compare: `remove` and `remove_entry_api` (empty cache)/remove_entry_api
                        time:   [566.02 us 587.06 us 613.11 us]

Copy link
Collaborator

@Robbepop Robbepop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just looked at the big picture so far not in detail.

core/src/storage2/lazy/mod.rs Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Jul 24, 2020

Codecov Report

Merging #480 into master will increase coverage by 0.81%.
The diff coverage is 97.58%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #480      +/-   ##
==========================================
+ Coverage   85.08%   85.89%   +0.81%     
==========================================
  Files         127      128       +1     
  Lines        5497     5800     +303     
==========================================
+ Hits         4677     4982     +305     
+ Misses        820      818       -2     
Impacted Files Coverage Δ
core/src/storage2/collections/hashmap/tests.rs 100.00% <ø> (ø)
core/src/storage2/lazy/entry.rs 95.34% <ø> (ø)
core/src/storage2/lazy/mod.rs 92.59% <ø> (ø)
core/src/storage2/lazy/lazy_cell.rs 98.21% <85.71%> (ø)
core/src/storage2/hashmap_entry_api_tests.rs 95.81% <95.81%> (ø)
core/src/storage2/collections/hashmap/mod.rs 99.17% <100.00%> (-0.04%) ⬇️
core/src/storage2/lazy/lazy_array.rs 96.26% <100.00%> (ø)
core/src/storage2/lazy/lazy_hmap.rs 98.98% <100.00%> (+1.48%) ⬆️
core/src/storage2/lazy/lazy_imap.rs 90.69% <100.00%> (+0.22%) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ba5aed1...758643c. Read the comment docs.

@cmichi cmichi marked this pull request as ready for review July 24, 2020 15:11
core/src/storage2/lazy/lazy_array.rs Outdated Show resolved Hide resolved
core/src/storage2/lazy/lazy_hmap.rs Outdated Show resolved Hide resolved
core/src/storage2/lazy/lazy_hmap.rs Outdated Show resolved Hide resolved
core/src/storage2/lazy/lazy_hmap.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@Robbepop Robbepop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good overall, some nits

core/src/storage2/collections/hashmap/mod.rs Outdated Show resolved Hide resolved
core/src/storage2/collections/hashmap/mod.rs Outdated Show resolved Hide resolved
core/src/storage2/hashmap_entry_api_tests.rs Outdated Show resolved Hide resolved
core/src/storage2/hashmap_entry_api_tests.rs Outdated Show resolved Hide resolved
core/src/storage2/hashmap_entry_api_tests.rs Outdated Show resolved Hide resolved
core/src/storage2/lazy/lazy_hmap.rs Outdated Show resolved Hide resolved
core/src/storage2/lazy/lazy_hmap.rs Outdated Show resolved Hide resolved
core/src/storage2/lazy/lazy_hmap.rs Outdated Show resolved Hide resolved
core/src/storage2/lazy/lazy_hmap.rs Outdated Show resolved Hide resolved
core/src/storage2/lazy/lazy_hmap.rs Show resolved Hide resolved
@cmichi cmichi force-pushed the cmichi-implement-lazyhashmap-entry-api branch 2 times, most recently from 383b791 to 3869bc6 Compare September 2, 2020 06:54
@cmichi cmichi force-pushed the cmichi-implement-lazyhashmap-entry-api branch from 3869bc6 to d64972c Compare September 2, 2020 06:56
@cmichi cmichi force-pushed the cmichi-implement-lazyhashmap-entry-api branch from 6d3fdcf to 5e4bdd5 Compare September 2, 2020 07:30
@cmichi cmichi force-pushed the cmichi-implement-lazyhashmap-entry-api branch from 5e4bdd5 to 758643c Compare September 2, 2020 07:31
@cmichi cmichi mentioned this pull request Sep 4, 2020
4 tasks
Copy link
Collaborator

@Robbepop Robbepop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cmichi cmichi merged commit c22562a into master Sep 10, 2020
@cmichi cmichi deleted the cmichi-implement-lazyhashmap-entry-api branch September 10, 2020 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement Entry API for storage2::LazyHashMap
3 participants