-
Notifications
You must be signed in to change notification settings - Fork 11
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 From<String> to avoid copying #4
Comments
For example?
|
Sort of. We want |
Here's another example:
It might be made into a generic |
That's impossible to test outside the |
This is the |
Code examples I gave aren't from |
I should check issues before doing PRs. Just run into this, so #6. I figured there is no point checking the lenght and doing an inline if you already have owned heap. |
On the contrary! Using the heap means an extra random memory access! Consider Consider If you're using a heap reference than you're fetching random pieces from all over the heap. This is especially bad if some of your memory is swapped out. Another example, a large long-living map. If the strings are stored inline then the memory pressure from that map is minimal (e.g. your program takes less memory). If the strings are on the heap then you're paying the full heap overhead (padding and metadata of the allocator). |
Hah. That does actually make a lot of sense. I've updated the PR. |
Fixed in #6 |
@maciejhirsz Benchmark in rust-lang/rust#40601 (comment) might be interesting regarding how the heap fetches (e.g. |
Might be a useful template if someone wants to experiment with benchmarking: https://gist.github.com/ArtemGr/cecca70d27178a1f1210df7bd53cf167 |
@ArtemGr are you interested in co-maintaining this crate? |
@fitzgen Yes, I wouldn't mind joining in. |
@ArtemGr Great, thanks! How does this sound for process: we lock down the master branch and require an approval review (presumably from one of us) and passing tests for anything to land on it? |
@fitzgen NP! I never worked with protected branches before, so... sure, looks like an interesting thing to try, at the very least. |
@ArtemGr cool! Invite sent. |
No description provided.
The text was updated successfully, but these errors were encountered: