-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
internal: Compress file text using LZ4 #16335
Conversation
Arc::from(text) | ||
} | ||
|
||
pub trait SourceDatabaseExt2 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we do this without a new trait?
555 KB for 16 files seems a bit much, but I guess these measurements are pretty rough. But why 1790 entries if the LRU size is set to 16? |
The entries persist, but the values get evicted. |
Right, I guess we just have a lot of code ( |
Doesn't make much of a difference in
|
What's less great about this is that it recompresses the file on every change. Can we store them in something like a |
Maybe? I know you can report synthetic reads in salsa so you could have a query that fakes reading from the file text input for example. But the question is whether that's worth the complication. I do wonder how often we'll end up decompressing files though, as a lot of IDE features will re-parse files pretty frequently currently. |
https://crates.io/crates/lz4_flex has some benchmarks. I hope we're not reparsing more than 1 MB at once. And we can increase the LRU size if necessary (not sure how we could tell though). |
The LRU will as usual depend on the project in question so its tough to figure out a good value for that. Regarding the synthetic read I would link a salsa test but github doesnt let me search the repo there right now. |
I think we also need synthetic writes? Or a way to update an input without invalidating it. I don't know 😅 |
Yes, thats called |
☔ The latest upstream changes (presumably #16339) made this pull request unmergeable. Please resolve the merge conflicts. |
6f557ab
to
cbc2bde
Compare
@Veykril think we could merge this in the current form, without the optimization that would avoid compressing the file being edited? It still looks a bit messy, not sure if that extension trait is needed. |
Should probably be fine. and yes I think we need the trait. |
☔ The latest upstream changes (presumably #16747) made this pull request unmergeable. Please resolve the merge conflicts. |
cbc2bde
to
a059166
Compare
a059166
to
db96d28
Compare
db96d28
to
717ba1d
Compare
Time to try this out I guess? |
☀️ Test successful - checks-actions |
I haven't tested properly, but this roughly looks like:
We might want to test on something more interesting, like
bevy
.