-
Notifications
You must be signed in to change notification settings - Fork 27
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
UnicodeWidthChar should inline an ascii fast path #1
Comments
Thanks! I'll have a look. |
This diff adds benchmarks to get more info regarding Issue #1. It appears that the remaining difference between the "simple" case and the "cargo" case is the result of a difference in performance between using `match` and `if` for tight loops. I suspect it's because of the way that match arms get reordered: if I manually reorder the "if" statement, I can reproduce the match performance. Also added a couple #[inline] annotations in tables.rs, though the difference in performance in my measurements is negligible. Bumped version number to 0.1.1.
Strange. On the machines on which I've tested, it appears that the remaining difference in performance between the "simple" case and the "cargo" case is due to the use of I suppose it might be worthwhile to modify the code to use an |
Hmm, that might be an interesting bug to file against the Rust match implementation, at least. |
Thinking about it a bit more, it's not necessarily surprising that the I'll have a closer look at the generated IR and try to confirm. |
(imported from improperly closed bug rust-lang/rust#20658 )
So, the good news is that this cargo package is beating the deprecated stdlib code on my machine.
The bad news is that it is still slower than what the original issue author expects to see.
(Though I also don't think the original issue author's code is conformant with what the docs here say the
fn width
method should do onchar
.)Anyway, here is a port of the benchmark provided by the original author, adapted to also test this cargo package. It is followed with the benchmark results on my machine.
The text was updated successfully, but these errors were encountered: