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: reduce memory consumption of CachedSource #144

Merged
merged 5 commits into from
Dec 12, 2024
Merged

Conversation

h-a-n-a
Copy link
Collaborator

@h-a-n-a h-a-n-a commented Dec 11, 2024

Use Rope to keep only a single copy of source. Previously, source was stored
for multiple times as long as cache was used.

Instead of creating a continuous string, Rope stores slices of Strings
and works like a string with a few string-like methods provided.

Known penalty:
Slicing Rope would likely to be slower if a large amount of chunks was stored.
Each byte_slice method would cost O(logN) time complexity to find the slice-containing chunks.

Copy link

codspeed-hq bot commented Dec 11, 2024

CodSpeed Performance Report

Merging #144 will not alter performance

Comparing refactor-cache (dea438d) with main (d85db3f)

Summary

✅ 7 untouched benchmarks

@h-a-n-a h-a-n-a changed the title refactor: cache refactor: reduce memory consumption of CachedSource Dec 11, 2024
* refactor: init

* refactor: faster lines

* refactor: try

* chore: clippy

* test: more

* chore: more
@h-a-n-a h-a-n-a merged commit 2b19331 into main Dec 12, 2024
7 checks passed
@h-a-n-a h-a-n-a deleted the refactor-cache branch December 12, 2024 13:06
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.

2 participants