-
-
Notifications
You must be signed in to change notification settings - Fork 705
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
20% more performance for popFront(char[]) #4849
Conversation
8975f54
to
6a6ca38
Compare
|
Can you post some measurements with code? |
|
okay some measurements |
6a6ca38
to
abe00ae
Compare
Maybe we can use this incident to start benchmarking directly in Phobos. A fancy way would be to run benchmarks for every PR to prevent performance regression, but a simpler approach is to at least collect them at a common place (e.g. |
abe00ae
to
2cb33be
Compare
2cb33be
to
7e3d336
Compare
|
closed until I found out how I am diverging from the spec. |
This doesn't tell me anything. What's the code? What's the data you're using? Are you testing just Unicode strings or are you testing with mixed ascii and Unicode? Etc. |
|
@JackStouffer I am using ASCII mixed with unicode, 80% Ascii, 20% unicode. |
a1934c3
to
6676abd
Compare
|
I am wondering about the freebsd failure. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@UplinkCoder how are you diverging from the spec?
| ]; | ||
| /* | ||
| This implementation of popFront does not special case 0b10xx_xxxx | ||
| Nither did the one before. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/Nither/Neither/
| /* | ||
| This implementation of popFront does not special case 0b10xx_xxxx | ||
| Nither did the one before. | ||
| on illigal strings we may skip too many bytes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/on/On/
s/illigal/illegal/
| This implementation of popFront does not special case 0b10xx_xxxx | ||
| Nither did the one before. | ||
| on illigal strings we may skip too many bytes. | ||
| */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this comment. So if the first byte has the shape 0x10xx_xxxx (illegal) we skip one byte which is what we need to do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... you are right
I had a brain-fart :)
|
Seems the autotester failure is a timeout. |
6676abd
to
4713fea
Compare
|
@andralex I do not diverge from the spec anymore. |
| msbs = 1; | ||
| } | ||
| str = str.ptr[min(msbs, str.length) .. str.length]; | ||
| str = str.ptr[min(str.length, charWidthTab[c - 192]) .. str.length]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use charWidthTab.ptr here, you've already bounds-checked it.
|
OK, I approve this. Regarding the scrutiny: until we have benchmarking for phobos we need to rely on self-reported performance measurements. |
4713fea
to
8bed6b2
Compare
|
Hmm I cannot merge myself .... |
Yes, but at least we can put the performance measurements into Phobos (or if wanted another common place), s.t. we can improve upon them & others can run the tests themselves. |
|
@wilzbach well, That's a project in and of itself, with its own build target, reporting, regression checks etc. etc. etc. I might be able to put someone on it, but it's way out of the scope of this PR. |
|
@UplinkCoder I've invited you |
|
@andralex great merged. |
You know - autotester is there for a reason :/ |
|
@UplinkCoder Please create a user id in the autotester and use its "Toggle automerge" feature to pull PRs. Thanks! |
We have something like that setup in druntime. A small benchmarks folder and a runner for microbenchmarks. No new std.benchmark or anything like that needed. |
|
@UplinkCoder please read and/or enhance https://github.com/dlang/phobos/blob/master/CONTRIBUTING.md and the linked wiki pages. |
|
@UplinkCoder To clarify, in order to use autotester for merging (I'm not sure if this is documented anywhere, it wasn't when I learned how to do it), click on the link to the auto tester in the list of running tests for your PR, e.g.: https://auto-tester.puremagic.com/pull-history.ghtml?projectid=1&repoid=3&pullid=4849 On the upper left corner is a "Login" link. Click on this, and it will link your github account into the auto-tester (not sure if any setup has to happen first time, I don't remember, it just works for me now). Now, the auto tester will provide at the top summary an "Auto-merge" toggle. Click that, and the auto tester will wait for all tests to pass, and merge on your behalf. Please use this when merging any PRs, it (almost) guarantees the master branch will always build.
@MartinNowak I couldn't find anything on auto-tester usage there. |
As per title.
On average 15% more performance because of smaller code and avoiding bsr