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

refactor: replace RangeMap with span-map for better range lookup #17006

Merged
merged 2 commits into from
Dec 6, 2024

Conversation

drmingdrmer
Copy link
Member

@drmingdrmer drmingdrmer commented Dec 5, 2024

I hereby agree to the terms of the CLA available at: https://docs.databend.com/dev/policies/cla/

Summary

refactor: replace RangeMap with span-map for better range lookup

Replace custom RangeMap implementation with span-map crate for more
efficient range operations. span-map uses BTreeMap internally to store
ranges, reducing boundary checks from O(n) to O(log n) when dealing
with overlapping ranges.

Also fixes single-key watch functionality that was previously broken.

Tests

  • Unit Test
  • Logic Test
  • Benchmark Test
  • No Test - Explain why

Type of change

  • Refactoring

Related Issues


This change is Reviewable

@github-actions github-actions bot added the pr-refactor this PR changes the code base without new features or bugfix label Dec 5, 2024
@drmingdrmer drmingdrmer changed the title refactor: replace range-map with well tested crate span-map refactor: replace RangeMap with span-map for better range lookup Dec 6, 2024
@drmingdrmer drmingdrmer marked this pull request as ready for review December 6, 2024 01:32
@drmingdrmer drmingdrmer force-pushed the 179-refactor branch 2 times, most recently from e881033 to a609111 Compare December 6, 2024 05:24
Replace custom `RangeMap` implementation with `span-map` crate for more
efficient range operations. `span-map` uses BTreeMap internally to store
ranges, reducing boundary checks from O(n) to O(log n) when dealing
with overlapping ranges.

Also fixes single-key watch functionality that was previously broken.
@drmingdrmer drmingdrmer merged commit e7e53e3 into databendlabs:main Dec 6, 2024
72 of 73 checks passed
@drmingdrmer drmingdrmer deleted the 179-refactor branch December 6, 2024 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-refactor this PR changes the code base without new features or bugfix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant