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

fs-storage : Add FolderStorage struct #81

Merged
merged 17 commits into from
Sep 2, 2024
Merged

fs-storage : Add FolderStorage struct #81

merged 17 commits into from
Sep 2, 2024

Conversation

Pushkarm029
Copy link
Collaborator

FileStorage struct retains core functionality from Kotlin implementation. #1

Signed-off-by: pushkarm029 <pushkarmishra029@gmail.com>
Signed-off-by: pushkarm029 <pushkarmishra029@gmail.com>
Copy link

Benchmark for 0f6797e

Click to view benchmark
Test Base PR %
blake3_resource_id_creation/compute_from_bytes:large 249.0±1.83µs 250.1±1.54µs +0.44%
blake3_resource_id_creation/compute_from_bytes:medium 15.6±0.07µs 15.6±0.23µs 0.00%
blake3_resource_id_creation/compute_from_bytes:small 1341.8±9.44ns 1348.3±10.68ns +0.48%
blake3_resource_id_creation/compute_from_path:../test-assets/lena.jpg 198.7±2.13µs 197.9±0.52µs -0.40%
blake3_resource_id_creation/compute_from_path:../test-assets/test.pdf 1762.7±6.94µs 1770.9±28.80µs +0.47%
crc32_resource_id_creation/compute_from_bytes:large 86.8±0.29µs 87.0±1.07µs +0.23%
crc32_resource_id_creation/compute_from_bytes:medium 5.4±0.01µs 5.4±0.01µs 0.00%
crc32_resource_id_creation/compute_from_bytes:small 92.6±0.36ns 92.7±0.51ns +0.11%
crc32_resource_id_creation/compute_from_path:../test-assets/lena.jpg 65.7±1.34µs 65.1±0.56µs -0.91%
crc32_resource_id_creation/compute_from_path:../test-assets/test.pdf 982.9±6.09µs 985.4±12.96µs +0.25%
index_build/index_build/../test-assets/ 1056.1±3.90µs 1055.4±5.92µs -0.07%

@Pushkarm029 Pushkarm029 requested a review from twitu July 20, 2024 17:38
Signed-off-by: pushkarm029 <pushkarmishra029@gmail.com>
Copy link

Benchmark for ec00992

Click to view benchmark
Test Base PR %
blake3_resource_id_creation/compute_from_bytes:large 250.7±0.90µs 251.4±0.43µs +0.28%
blake3_resource_id_creation/compute_from_bytes:medium 15.6±0.07µs 15.6±0.14µs 0.00%
blake3_resource_id_creation/compute_from_bytes:small 1346.7±5.82ns 1346.5±6.41ns -0.01%
blake3_resource_id_creation/compute_from_path:../test-assets/lena.jpg 199.9±0.48µs 198.2±0.85µs -0.85%
blake3_resource_id_creation/compute_from_path:../test-assets/test.pdf 1757.4±4.64µs 1761.4±21.66µs +0.23%
crc32_resource_id_creation/compute_from_bytes:large 86.7±0.36µs 86.7±0.38µs 0.00%
crc32_resource_id_creation/compute_from_bytes:medium 5.4±0.03µs 5.4±0.23µs 0.00%
crc32_resource_id_creation/compute_from_bytes:small 93.0±0.83ns 93.0±0.29ns 0.00%
crc32_resource_id_creation/compute_from_path:../test-assets/lena.jpg 65.0±0.51µs 65.1±0.37µs +0.15%
crc32_resource_id_creation/compute_from_path:../test-assets/test.pdf 973.9±4.69µs 970.9±4.09µs -0.31%
index_build/index_build/../test-assets/ 1057.9±5.23µs 1049.4±5.96µs -0.80%

Signed-off-by: pushkarm029 <pushkarmishra029@gmail.com>
Copy link

Benchmark for 34f12c2

Click to view benchmark
Test Base PR %
blake3_resource_id_creation/compute_from_bytes:large 250.8±0.57µs 251.7±1.85µs +0.36%
blake3_resource_id_creation/compute_from_bytes:medium 15.5±0.06µs 15.5±0.06µs 0.00%
blake3_resource_id_creation/compute_from_bytes:small 1348.1±5.33ns 1349.2±2.10ns +0.08%
blake3_resource_id_creation/compute_from_path:../test-assets/lena.jpg 198.6±0.43µs 198.1±2.07µs -0.25%
blake3_resource_id_creation/compute_from_path:../test-assets/test.pdf 1769.4±7.55µs 1768.9±37.68µs -0.03%
crc32_resource_id_creation/compute_from_bytes:large 87.0±0.62µs 86.7±0.54µs -0.34%
crc32_resource_id_creation/compute_from_bytes:medium 5.4±0.11µs 5.4±0.02µs 0.00%
crc32_resource_id_creation/compute_from_bytes:small 93.2±0.95ns 93.0±0.45ns -0.21%
crc32_resource_id_creation/compute_from_path:../test-assets/lena.jpg 65.3±0.26µs 65.2±0.51µs -0.15%
crc32_resource_id_creation/compute_from_path:../test-assets/test.pdf 983.6±7.35µs 971.9±7.12µs -1.19%
index_build/index_build/../test-assets/ 1144.1±10.93µs 1050.6±6.41µs -8.17%

Signed-off-by: pushkarm029 <pushkarmishra029@gmail.com>
@Pushkarm029
Copy link
Collaborator Author

Tests are failing due to this:

error: unexpected `cfg` condition value: `unix`
 --> fs-atomic-versions/src/atomic/file.rs:3:7
  |
3 | #[cfg(target_os = "unix")]
  |       ^^^^^^^^^^^^^^^^^^
  |
  = note: expected values for `target_os` are: `aix`, `android`, `cuda`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `macos`, `netbsd`, `none`, `nto`, `openbsd`, `psp`, `redox`, `solaris`, `solid_asp3`, `teeos`, `tvos`, `uefi`, `unknown`, `visionos`, `vita`, `vxworks`, `wasi`, `watchos`, and `windows` and 2 more
  = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
  = note: `-D unexpected-cfgs` implied by `-D warnings`
  = help: to override `-D warnings` add `#[allow(unexpected_cfgs)]`

Copy link

Benchmark for 2e2d106

Click to view benchmark
Test Base PR %
blake3_resource_id_creation/compute_from_bytes:large 249.4±1.05µs 249.1±2.74µs -0.12%
blake3_resource_id_creation/compute_from_bytes:medium 15.6±0.13µs 15.6±0.12µs 0.00%
blake3_resource_id_creation/compute_from_bytes:small 1347.0±2.00ns 1350.7±2.55ns +0.27%
blake3_resource_id_creation/compute_from_path:../test-assets/lena.jpg 198.1±0.88µs 198.7±0.58µs +0.30%
blake3_resource_id_creation/compute_from_path:../test-assets/test.pdf 1775.0±10.05µs 1781.2±23.93µs +0.35%
crc32_resource_id_creation/compute_from_bytes:large 86.8±1.13µs 86.8±1.01µs 0.00%
crc32_resource_id_creation/compute_from_bytes:medium 5.4±0.02µs 5.4±0.03µs 0.00%
crc32_resource_id_creation/compute_from_bytes:small 93.1±0.65ns 93.0±0.40ns -0.11%
crc32_resource_id_creation/compute_from_path:../test-assets/lena.jpg 65.0±0.22µs 65.3±1.08µs +0.46%
crc32_resource_id_creation/compute_from_path:../test-assets/test.pdf 976.1±4.68µs 981.5±6.64µs +0.55%
index_build/index_build/../test-assets/ 1059.9±21.00µs 1055.3±2.99µs -0.43%

Copy link
Collaborator

@twitu twitu left a comment

Choose a reason for hiding this comment

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

The CI seems to failing on some formatting/linting issues. Solid v1 implementation looks good to merge once that's fixed.

Signed-off-by: pushkarm029 <pushkarmishra029@gmail.com>
Signed-off-by: pushkarm029 <pushkarmishra029@gmail.com>
Copy link

Benchmark for 9544429

Click to view benchmark
Test Base PR %
blake3_resource_id_creation/compute_from_bytes:large 249.7±0.52µs 249.4±0.85µs -0.12%
blake3_resource_id_creation/compute_from_bytes:medium 15.6±0.07µs 15.6±0.04µs 0.00%
blake3_resource_id_creation/compute_from_bytes:small 1395.7±12.67ns 1388.7±21.74ns -0.50%
blake3_resource_id_creation/compute_from_path:../test-assets/lena.jpg 197.0±0.47µs 197.3±4.69µs +0.15%
blake3_resource_id_creation/compute_from_path:../test-assets/test.pdf 1741.8±4.15µs 1739.8±14.03µs -0.11%
crc32_resource_id_creation/compute_from_bytes:large 86.7±0.24µs 86.7±0.47µs 0.00%
crc32_resource_id_creation/compute_from_bytes:medium 5.4±0.02µs 5.4±0.03µs 0.00%
crc32_resource_id_creation/compute_from_bytes:small 92.3±0.35ns 92.4±0.88ns +0.11%
crc32_resource_id_creation/compute_from_path:../test-assets/lena.jpg 64.8±0.36µs 65.1±0.26µs +0.46%
crc32_resource_id_creation/compute_from_path:../test-assets/test.pdf 965.2±2.94µs 959.5±5.70µs -0.59%
index_build/index_build/../test-assets/ 1037.6±4.85µs 1037.4±6.71µs -0.02%

Copy link

Benchmark for 72ac334

Click to view benchmark
Test Base PR %
blake3_resource_id_creation/compute_from_bytes:large 254.3±2.39µs 251.3±3.77µs -1.18%
blake3_resource_id_creation/compute_from_bytes:medium 15.7±0.42µs 15.6±0.09µs -0.64%
blake3_resource_id_creation/compute_from_bytes:small 1382.8±9.32ns 1389.1±7.78ns +0.46%
blake3_resource_id_creation/compute_from_path:../test-assets/lena.jpg 196.9±0.65µs 197.6±2.04µs +0.36%
blake3_resource_id_creation/compute_from_path:../test-assets/test.pdf 1742.4±8.58µs 1751.9±34.11µs +0.55%
crc32_resource_id_creation/compute_from_bytes:large 87.2±0.78µs 87.4±1.18µs +0.23%
crc32_resource_id_creation/compute_from_bytes:medium 5.4±0.09µs 5.4±0.02µs 0.00%
crc32_resource_id_creation/compute_from_bytes:small 92.6±1.08ns 92.4±0.99ns -0.22%
crc32_resource_id_creation/compute_from_path:../test-assets/lena.jpg 65.5±0.39µs 66.6±0.42µs +1.68%
crc32_resource_id_creation/compute_from_path:../test-assets/test.pdf 988.0±5.62µs 973.2±9.50µs -1.50%
index_build/index_build/../test-assets/ 1055.9±5.18µs 1042.9±13.26µs -1.23%

@Pushkarm029 Pushkarm029 marked this pull request as ready for review July 29, 2024 15:43
@Pushkarm029
Copy link
Collaborator Author

Thanks for the review

Signed-off-by: pushkarm029 <pushkarmishra029@gmail.com>
Signed-off-by: pushkarm029 <pushkarmishra029@gmail.com>
Copy link

github-actions bot commented Aug 9, 2024

Benchmark for 8a9fc06

Click to view benchmark
Test Base PR %
blake3_resource_id_creation/compute_from_bytes:large 250.1±0.55µs 247.2±1.99µs -1.16%
blake3_resource_id_creation/compute_from_bytes:medium 15.6±0.06µs 15.7±0.04µs +0.64%
blake3_resource_id_creation/compute_from_bytes:small 1344.9±1.85ns 1345.9±3.96ns +0.07%
blake3_resource_id_creation/compute_from_path:../test-assets/lena.jpg 199.9±0.66µs 196.9±0.66µs -1.50%
blake3_resource_id_creation/compute_from_path:../test-assets/test.pdf 1790.5±6.07µs 1779.2±40.99µs -0.63%
crc32_resource_id_creation/compute_from_bytes:large 91.8±1.25µs 91.8±2.05µs 0.00%
crc32_resource_id_creation/compute_from_bytes:medium 5.7±0.02µs 5.7±0.02µs 0.00%
crc32_resource_id_creation/compute_from_bytes:small 96.5±0.26ns 96.5±0.31ns 0.00%
crc32_resource_id_creation/compute_from_path:../test-assets/lena.jpg 64.6±0.68µs 64.7±0.75µs +0.15%
crc32_resource_id_creation/compute_from_path:../test-assets/test.pdf 953.7±4.13µs 949.9±4.73µs -0.40%
resource_index/index_build//tmp/ark-fs-index-benchmarksuoV0oj 108.8±1.40ms N/A N/A
resource_index/index_build//tmp/ark-fs-index-benchmarkszguu4H 109.4±1.28ms N/A N/A
resource_index/index_get_resource_by_id 97.7±0.34ns 98.0±1.25ns +0.31%
resource_index/index_get_resource_by_path 53.4±0.31ns 52.2±0.40ns -2.25%
resource_index/index_update_all 1124.7±33.45ms 1122.6±53.79ms -0.19%

Copy link

github-actions bot commented Aug 9, 2024

Benchmark for 87c3e0f

Click to view benchmark
Test Base PR %
blake3_resource_id_creation/compute_from_bytes:large 249.5±0.98µs 247.7±1.09µs -0.72%
blake3_resource_id_creation/compute_from_bytes:medium 15.6±0.04µs 15.7±0.28µs +0.64%
blake3_resource_id_creation/compute_from_bytes:small 1343.8±1.76ns 1388.9±7.81ns +3.36%
blake3_resource_id_creation/compute_from_path:../test-assets/lena.jpg 196.9±0.69µs 197.4±0.38µs +0.25%
blake3_resource_id_creation/compute_from_path:../test-assets/test.pdf 1774.1±5.56µs 1785.2±34.98µs +0.63%
crc32_resource_id_creation/compute_from_bytes:large 91.5±0.16µs 91.5±0.25µs 0.00%
crc32_resource_id_creation/compute_from_bytes:medium 5.7±0.03µs 5.7±0.01µs 0.00%
crc32_resource_id_creation/compute_from_bytes:small 96.6±0.41ns 96.6±0.19ns 0.00%
crc32_resource_id_creation/compute_from_path:../test-assets/lena.jpg 64.7±0.32µs 65.5±0.88µs +1.24%
crc32_resource_id_creation/compute_from_path:../test-assets/test.pdf 951.9±2.62µs 950.6±2.75µs -0.14%
resource_index/index_build//tmp/ark-fs-index-benchmarks3Q9uIW 108.0±1.32ms N/A N/A
resource_index/index_build//tmp/ark-fs-index-benchmarkscgJyuj 109.4±1.64ms N/A N/A
resource_index/index_get_resource_by_id 97.7±0.29ns 97.4±0.40ns -0.31%
resource_index/index_get_resource_by_path 52.6±1.01ns 52.9±0.39ns +0.57%
resource_index/index_update_all 1107.3±30.04ms 1108.4±51.46ms +0.10%

Copy link

Benchmark for c609ab2

Click to view benchmark
Test Base PR %
blake3_resource_id_creation/compute_from_bytes:large 249.2±2.37µs 248.9±1.18µs -0.12%
blake3_resource_id_creation/compute_from_bytes:medium 15.6±0.07µs 15.6±0.11µs 0.00%
blake3_resource_id_creation/compute_from_bytes:small 1379.0±9.90ns 1362.1±2.24ns -1.23%
blake3_resource_id_creation/compute_from_path:../test-assets/lena.jpg 196.8±0.28µs 197.7±0.53µs +0.46%
blake3_resource_id_creation/compute_from_path:../test-assets/test.pdf 1727.2±6.99µs 1738.6±17.16µs +0.66%
crc32_resource_id_creation/compute_from_bytes:large 86.6±0.36µs 86.7±0.32µs +0.12%
crc32_resource_id_creation/compute_from_bytes:medium 5.4±0.01µs 5.4±0.01µs 0.00%
crc32_resource_id_creation/compute_from_bytes:small 92.6±0.43ns 92.3±0.25ns -0.32%
crc32_resource_id_creation/compute_from_path:../test-assets/lena.jpg 64.9±0.41µs 64.6±0.39µs -0.46%
crc32_resource_id_creation/compute_from_path:../test-assets/test.pdf 984.2±5.29µs 953.0±4.05µs -3.17%
resource_index/index_build//tmp/ark-fs-index-benchmarksUQm1uy 113.2±0.91ms N/A N/A
resource_index/index_build//tmp/ark-fs-index-benchmarksiYIhNZ 111.6±1.30ms N/A N/A
resource_index/index_get_resource_by_id 97.5±0.49ns 97.2±0.42ns -0.31%
resource_index/index_get_resource_by_path 55.2±0.38ns 53.3±0.46ns -3.44%
resource_index/index_update_all 1128.2±40.82ms 1150.8±42.36ms +2.00%

Copy link
Member

Choose a reason for hiding this comment

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

@kirillt try this

@kirillt kirillt self-requested a review August 18, 2024 23:54
Copy link
Member

@kirillt kirillt left a comment

Choose a reason for hiding this comment

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

Thanks for the great work, but we should polish raw edges here

* Add property test

* Use print statements

* experimental changes

Signed-off-by: pushkarm029 <pushkarmishra029@gmail.com>

* fix

Signed-off-by: pushkarm029 <pushkarmishra029@gmail.com>

* fix

Signed-off-by: pushkarm029 <pushkarmishra029@gmail.com>

* Refactor to remove unwraps

* Fix folderstorage model with strong deletes

---------

Signed-off-by: pushkarm029 <pushkarmishra029@gmail.com>
Co-authored-by: pushkarm029 <pushkarmishra029@gmail.com>
@twitu
Copy link
Collaborator

twitu commented Aug 22, 2024

After experimenting with various synchronization models for concurrent operations, the "StrongDelete" approach is coming out to be the most effective in terms of code complexity and efficiency with passing tests.

The synchronization model can be stated as below -

  • For concurrent insert and remove, the last writer wins
  • For concurrent insert and external modification to disk, use monoidal combine to merge changes
  • For concurrent delete and external modifications to disk, delete wins

Copy link

Benchmark for ff228d7

Click to view benchmark
Test Base PR %
blake3_resource_id_creation/compute_from_bytes:large 247.6±0.91µs 247.8±0.41µs +0.08%
blake3_resource_id_creation/compute_from_bytes:medium 15.7±0.03µs 15.5±0.07µs -1.27%
blake3_resource_id_creation/compute_from_bytes:small 1383.5±3.39ns 1357.9±8.15ns -1.85%
blake3_resource_id_creation/compute_from_path:../test-assets/lena.jpg 197.2±0.25µs 197.5±0.77µs +0.15%
blake3_resource_id_creation/compute_from_path:../test-assets/test.pdf 1743.2±9.02µs 1777.6±62.51µs +1.97%
crc32_resource_id_creation/compute_from_bytes:large 86.6±0.30µs 86.6±0.47µs 0.00%
crc32_resource_id_creation/compute_from_bytes:medium 5.4±0.22µs 5.4±0.03µs 0.00%
crc32_resource_id_creation/compute_from_bytes:small 92.9±0.19ns 92.3±0.47ns -0.65%
crc32_resource_id_creation/compute_from_path:../test-assets/lena.jpg 64.5±0.33µs 65.2±0.35µs +1.09%
crc32_resource_id_creation/compute_from_path:../test-assets/test.pdf 977.1±2.76µs 981.4±4.35µs +0.44%
resource_index/index_build//tmp/ark-fs-index-benchmarks18NoLf 103.6±0.65ms N/A N/A
resource_index/index_build//tmp/ark-fs-index-benchmarksI7gJnI 103.5±1.26ms N/A N/A
resource_index/index_get_resource_by_id 96.8±0.35ns 98.7±0.30ns +1.96%
resource_index/index_get_resource_by_path 53.0±0.45ns 55.6±0.39ns +4.91%
resource_index/index_update_all 1086.8±30.25ms 1098.6±65.32ms +1.09%

Copy link

Benchmark for 3916630

Click to view benchmark
Test Base PR %
blake3_resource_id_creation/compute_from_bytes:large 250.6±1.06µs 250.2±0.97µs -0.16%
blake3_resource_id_creation/compute_from_bytes:medium 15.6±0.09µs 15.5±0.05µs -0.64%
blake3_resource_id_creation/compute_from_bytes:small 1383.6±2.32ns 1356.1±4.24ns -1.99%
blake3_resource_id_creation/compute_from_path:../test-assets/lena.jpg 197.0±0.52µs 197.4±0.65µs +0.20%
blake3_resource_id_creation/compute_from_path:../test-assets/test.pdf 1739.4±11.13µs 1772.8±23.57µs +1.92%
crc32_resource_id_creation/compute_from_bytes:large 86.6±0.25µs 86.6±0.32µs 0.00%
crc32_resource_id_creation/compute_from_bytes:medium 5.4±0.02µs 5.4±0.02µs 0.00%
crc32_resource_id_creation/compute_from_bytes:small 92.9±0.22ns 92.3±0.21ns -0.65%
crc32_resource_id_creation/compute_from_path:../test-assets/lena.jpg 64.4±0.31µs 64.7±0.53µs +0.47%
crc32_resource_id_creation/compute_from_path:../test-assets/test.pdf 971.4±4.36µs 956.7±5.00µs -1.51%
resource_index/index_build//tmp/ark-fs-index-benchmarks4fZLZD 106.0±1.23ms N/A N/A
resource_index/index_build//tmp/ark-fs-index-benchmarkszZ0gY2 106.9±1.36ms N/A N/A
resource_index/index_get_resource_by_id 96.9±0.32ns 99.1±0.30ns +2.27%
resource_index/index_get_resource_by_path 53.3±0.49ns 53.2±0.41ns -0.19%
resource_index/index_update_all 1095.3±23.89ms 1119.1±54.39ms +2.17%

Signed-off-by: pushkarm029 <pushkarmishra029@gmail.com>
Copy link

Benchmark for d0e0f38

Click to view benchmark
Test Base PR %
blake3_resource_id_creation/compute_from_bytes:large 251.1±0.72µs 248.8±4.39µs -0.92%
blake3_resource_id_creation/compute_from_bytes:medium 15.6±0.03µs 15.6±0.06µs 0.00%
blake3_resource_id_creation/compute_from_bytes:small 1387.1±2.19ns 1347.7±10.81ns -2.84%
blake3_resource_id_creation/compute_from_path:../test-assets/lena.jpg 197.3±0.77µs 197.4±0.73µs +0.05%
blake3_resource_id_creation/compute_from_path:../test-assets/test.pdf 1743.5±3.56µs 1805.8±33.24µs +3.57%
crc32_resource_id_creation/compute_from_bytes:large 86.7±0.40µs 86.8±0.57µs +0.12%
crc32_resource_id_creation/compute_from_bytes:medium 5.4±0.01µs 5.4±0.02µs 0.00%
crc32_resource_id_creation/compute_from_bytes:small 92.7±0.31ns 92.4±0.27ns -0.32%
crc32_resource_id_creation/compute_from_path:../test-assets/lena.jpg 65.1±0.17µs 64.6±0.59µs -0.77%
crc32_resource_id_creation/compute_from_path:../test-assets/test.pdf 989.6±2.35µs 954.7±5.29µs -3.53%
resource_index/index_build//tmp/ark-fs-index-benchmarksJMhVhN 108.7±3.22ms N/A N/A
resource_index/index_build//tmp/ark-fs-index-benchmarksfBkzwI 105.6±1.33ms N/A N/A
resource_index/index_get_resource_by_id 100.3±1.54ns 97.6±2.07ns -2.69%
resource_index/index_get_resource_by_path 54.2±0.51ns 53.1±0.29ns -2.03%
resource_index/index_update_all 1093.7±31.18ms 1092.7±41.52ms -0.09%

Signed-off-by: pushkarm029 <pushkarmishra029@gmail.com>
Signed-off-by: pushkarm029 <pushkarmishra029@gmail.com>
Copy link

Benchmark for d0d1e04

Click to view benchmark
Test Base PR %
blake3_resource_id_creation/compute_from_bytes:large 249.4±0.51µs 249.7±1.43µs +0.12%
blake3_resource_id_creation/compute_from_bytes:medium 15.7±0.07µs 15.6±0.18µs -0.64%
blake3_resource_id_creation/compute_from_bytes:small 1378.5±8.08ns 1352.1±3.87ns -1.92%
blake3_resource_id_creation/compute_from_path:../test-assets/lena.jpg 196.7±0.47µs 197.5±0.56µs +0.41%
blake3_resource_id_creation/compute_from_path:../test-assets/test.pdf 1748.1±15.98µs 1766.1±23.00µs +1.03%
crc32_resource_id_creation/compute_from_bytes:large 86.8±1.23µs 86.7±0.24µs -0.12%
crc32_resource_id_creation/compute_from_bytes:medium 5.4±0.06µs 5.4±0.02µs 0.00%
crc32_resource_id_creation/compute_from_bytes:small 93.0±0.46ns 92.6±1.94ns -0.43%
crc32_resource_id_creation/compute_from_path:../test-assets/lena.jpg 65.1±0.41µs 64.7±1.36µs -0.61%
crc32_resource_id_creation/compute_from_path:../test-assets/test.pdf 983.6±5.99µs 952.0±2.13µs -3.21%
resource_index/index_build//tmp/ark-fs-index-benchmarksdZUeCe 103.7±1.41ms N/A N/A
resource_index/index_build//tmp/ark-fs-index-benchmarkszu1XLY 103.0±2.35ms N/A N/A
resource_index/index_get_resource_by_id 100.6±1.41ns 97.2±0.51ns -3.38%
resource_index/index_get_resource_by_path 53.1±0.28ns 52.9±0.19ns -0.38%
resource_index/index_update_all 1099.7±40.18ms 1103.4±51.89ms +0.34%

Copy link

Benchmark for 05dbed4

Click to view benchmark
Test Base PR %
blake3_resource_id_creation/compute_from_bytes:large 260.2±48.73µs 248.6±4.13µs -4.46%
blake3_resource_id_creation/compute_from_bytes:medium 15.7±0.05µs 15.5±0.03µs -1.27%
blake3_resource_id_creation/compute_from_bytes:small 1385.5±7.31ns 1334.9±6.00ns -3.65%
blake3_resource_id_creation/compute_from_path:../test-assets/lena.jpg 196.9±0.28µs 197.6±1.59µs +0.36%
blake3_resource_id_creation/compute_from_path:../test-assets/test.pdf 1741.7±3.62µs 1772.6±38.32µs +1.77%
crc32_resource_id_creation/compute_from_bytes:large 86.7±0.21µs 86.7±0.14µs 0.00%
crc32_resource_id_creation/compute_from_bytes:medium 5.4±0.02µs 5.4±0.02µs 0.00%
crc32_resource_id_creation/compute_from_bytes:small 92.9±0.18ns 92.3±0.40ns -0.65%
crc32_resource_id_creation/compute_from_path:../test-assets/lena.jpg 65.2±0.20µs 64.7±1.31µs -0.77%
crc32_resource_id_creation/compute_from_path:../test-assets/test.pdf 983.1±3.09µs 954.4±5.98µs -2.92%
resource_index/index_build//tmp/ark-fs-index-benchmarksdFSTT5 103.8±1.86ms N/A N/A
resource_index/index_build//tmp/ark-fs-index-benchmarksmX32KM 102.8±0.78ms N/A N/A
resource_index/index_get_resource_by_id 97.4±0.43ns 98.5±0.38ns +1.13%
resource_index/index_get_resource_by_path 53.1±0.21ns 52.2±0.20ns -1.69%
resource_index/index_update_all 1107.3±37.97ms 1091.9±39.59ms -1.39%

Copy link

Benchmark for d4ab4a8

Click to view benchmark
Test Base PR %
blake3_resource_id_creation/compute_from_bytes:large 251.9±1.10µs 248.2±1.00µs -1.47%
blake3_resource_id_creation/compute_from_bytes:medium 15.7±0.11µs 15.6±0.05µs -0.64%
blake3_resource_id_creation/compute_from_bytes:small 1384.6±4.25ns 1352.4±2.93ns -2.33%
blake3_resource_id_creation/compute_from_path:../test-assets/lena.jpg 197.7±1.53µs 197.6±1.47µs -0.05%
blake3_resource_id_creation/compute_from_path:../test-assets/test.pdf 1771.1±11.08µs 1767.0±12.54µs -0.23%
crc32_resource_id_creation/compute_from_bytes:large 86.7±0.40µs 86.8±0.44µs +0.12%
crc32_resource_id_creation/compute_from_bytes:medium 5.4±0.02µs 5.4±0.05µs 0.00%
crc32_resource_id_creation/compute_from_bytes:small 92.9±0.46ns 92.3±0.40ns -0.65%
crc32_resource_id_creation/compute_from_path:../test-assets/lena.jpg 64.9±0.22µs 64.8±0.44µs -0.15%
crc32_resource_id_creation/compute_from_path:../test-assets/test.pdf 990.1±5.05µs 954.9±4.95µs -3.56%
resource_index/index_build//tmp/ark-fs-index-benchmarksAQPKAZ 102.7±0.88ms N/A N/A
resource_index/index_build//tmp/ark-fs-index-benchmarksPO4vhA 102.3±1.13ms N/A N/A
resource_index/index_get_resource_by_id 98.9±0.48ns 97.7±0.49ns -1.21%
resource_index/index_get_resource_by_path 52.3±0.27ns 53.0±0.29ns +1.34%
resource_index/index_update_all 1091.0±41.31ms 1150.7±81.65ms +5.47%

Copy link
Collaborator

@tareknaser tareknaser left a comment

Choose a reason for hiding this comment

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

Thank you for the excellent work. I tested the CLI too, and it works perfectly as expected.

I still want to take a closer look at the tests though, especially the fancy property testing 😃

.get(key)
.map(|disk_stamp| ram_stamp > disk_stamp)
})
.unwrap_or(false);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are we defaulting to false here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@twitu

btw, defaulting to true also works

Copy link
Collaborator

Choose a reason for hiding this comment

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

The existing_value_updated triggers a monoidal combine of values for a particular key.

Right now it works because the property based test uses a Dummy value which has a "dumb" monoidal implementation which does nothing i.e. combine(dummy, dummy) = dummy.

However, when we use values like strings or numbers that have useful monoidal implementations, we want to appropriately set the existing_value_updated flag. We want to combine things only if values have diverged in both memory and storage. So the default should be false, if the value is not updated it is simply set and not combined.

Ok(())
}
/// Resolve differences between memory and disk data
fn resolve_divergence(&mut self) -> Result<()> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm sorry, but could you explain what this method does?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It is just an enhanced version of 'merge_from' for resolving divergence. The method considers timestamps to detect keys where we need to use monoids to resolve conflicts.

Added this comment here:

    /// Resolves discrepancies between in-memory data and disk data by combining or
    /// overwriting values based on which version is more recent, ensuring consistency.

Signed-off-by: pushkarm029 <pushkarmishra029@gmail.com>
Copy link

Benchmark for 3075bea

Click to view benchmark
Test Base PR %
blake3_resource_id_creation/compute_from_bytes:large 247.1±0.92µs 248.9±0.87µs +0.73%
blake3_resource_id_creation/compute_from_bytes:medium 15.7±0.07µs 15.6±0.14µs -0.64%
blake3_resource_id_creation/compute_from_bytes:small 1376.5±13.49ns 1353.6±3.07ns -1.66%
blake3_resource_id_creation/compute_from_path:../test-assets/lena.jpg 197.2±0.90µs 197.5±0.57µs +0.15%
blake3_resource_id_creation/compute_from_path:../test-assets/test.pdf 1746.0±17.82µs 1762.9±14.86µs +0.97%
crc32_resource_id_creation/compute_from_bytes:large 86.5±0.33µs 86.6±0.31µs +0.12%
crc32_resource_id_creation/compute_from_bytes:medium 5.4±0.04µs 5.4±0.02µs 0.00%
crc32_resource_id_creation/compute_from_bytes:small 93.0±0.42ns 92.5±1.45ns -0.54%
crc32_resource_id_creation/compute_from_path:../test-assets/lena.jpg 65.8±2.74µs 64.5±0.37µs -1.98%
crc32_resource_id_creation/compute_from_path:../test-assets/test.pdf 1000.8±40.96µs 957.2±5.31µs -4.36%
resource_index/index_build//tmp/ark-fs-index-benchmarksInX4OT 102.3±0.68ms N/A N/A
resource_index/index_build//tmp/ark-fs-index-benchmarksTQlogX 103.0±1.27ms N/A N/A
resource_index/index_get_resource_by_id 97.5±1.67ns 96.7±0.40ns -0.82%
resource_index/index_get_resource_by_path 52.6±0.32ns 53.4±0.38ns +1.52%
resource_index/index_update_all 1107.4±46.21ms 1141.3±59.58ms +3.06%

Copy link
Collaborator

@tareknaser tareknaser left a comment

Choose a reason for hiding this comment

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

Thank you. No more comments from my side.

@twitu twitu merged commit 6c4d8a0 into main Sep 2, 2024
4 checks passed
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.

4 participants