-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
to_string causes crazy memory usage problems #16415
Comments
String is a buffer, later appends will benefits from it. If don't need a |
@liigo it needs to be dynamic constructed (i.e. |
Just so it does not get lost in the shuffle, here is my current half-baked idea to address this:
see related bit of discussion here: https://botbot.me/mozilla/rust-internals/2014-08-11/?msg=19511520&page=2 It would put a minor road-block before you could call |
@pnkfelix adding the hint method to |
Good ideas. Should we use the upper bound for all integers? What about different bases? I think that integers shouldn't implement |
The
How will they convey the computed number of digits if they don't implement that trait and method? |
I've just found out that
By using either |
|
Then it's as simple as extending these macros. I can do that. |
It seems that this issue can be closed now.
Now the buffer size is incremented to fit the minimum 2^n. |
That makes it seem like it's just pushing them without using |
@thestinger Uhm, yeah, you're right. Now I'm worried that not using |
Rust was just picking 128 as an arbitrary amount to reserve up front before. Not using a size hint will have a severe impact on performance, but clamping to 128 was worse. |
…Veykril internal: Make TryToNav trait public Currently there is no proper way to get a target FileRange for a given Definition.
5u32.to_string().byte_capacity()
->128
"foo".to_string().byte_capacity()
->128
I think the right solution to this is adding size hints to the underlying formatting system.
The text was updated successfully, but these errors were encountered: