Skip to content

Make a version of char::escape_unicode that doesn't allocate #4423

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

Closed
catamorphism opened this issue Jan 10, 2013 · 3 comments
Closed

Make a version of char::escape_unicode that doesn't allocate #4423

catamorphism opened this issue Jan 10, 2013 · 3 comments
Labels
I-slow Issue: Problems and improvements with respect to performance of generated code.

Comments

@catamorphism
Copy link
Contributor

As per FIXME (former XXX) in write_escaped_char in core::repr. I guess escape_unicode could be rewritten to take a closure of type fn(char).

@catamorphism
Copy link
Contributor Author

Relatedly: the impls of Repr for float, f32, and f64 in the same file also malloc, when they don't have to.

@ghost
Copy link

ghost commented Feb 9, 2013

If I am understanding correctly, escape_unicode should be (char, fn(char))? If that is the approach, it also requires changing num:to_str_common and u*:to_str_radix to have a similar signature. That is, it seems as though a lot of the built-in functions that return ~str should instead accept a fn(char) that will be called with each resulting character.

alexcrichton added a commit to alexcrichton/rust that referenced this issue Jun 30, 2013
This allows the integral paths to avoid allocations on the heap

Closes rust-lang#4424, rust-lang#4423
@alexcrichton
Copy link
Member

Closed in d3155fa

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-slow Issue: Problems and improvements with respect to performance of generated code.
Projects
None yet
Development

No branches or pull requests

2 participants