Skip to content

String routine optimisations #6182

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
wants to merge 2 commits into from
Closed

Conversation

huonw
Copy link
Member

@huonw huonw commented May 2, 2013

This adds #[inline] to many very common string routines (e.g. len).

It also rewrites repeat to not use += and make it O(n) rather than O(n^2), and also concat/connect(_slices) to reduce the overhead of reallocations, and constantly set_lening (etc) in push_str. (The added complexity might not be worth the 20% speedup though.)

huonw added 2 commits May 2, 2013 18:03
This makes concat/connect/connect_slices about 20% faster, and takes
`repeat` from O(n^2) to O(n), and lowers the constant factor.
bors added a commit that referenced this pull request May 2, 2013
This adds #[inline] to many very common string routines (e.g. `len`).

It also rewrites `repeat` to not use `+=` and make it O(n) rather than O(n^2), and also concat/connect(_slices) to reduce the overhead of reallocations, and constantly `set_len`ing (etc) in `push_str`. (The added complexity might not be worth the 20% speedup though.)
@bors bors closed this May 2, 2013
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.

3 participants