-
Notifications
You must be signed in to change notification settings - Fork 103
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
Significant performance regression from 0.8.6 to 0.8.7 #194
Comments
Looking into this, I found the code was not using the proper fast path, I will correct this in the next major release, it will take some time. However this is not the cause of the regression, as the old version was also using the slower path. @rodya-mirov Can you run a |
Hi thanks for looking. I felt quite bad about dumping such a non-minimal example. Here is a better one (I didn't realize it would be this easy). Source code:
On 0.8.6, took 1.86s Timings are relatively stable. I'm not sure I'm using Happy to try with different arguments but it's an unfamiliar tool and I'm not sure what I'm looking for. |
If That leaves two possibilities: there is a difference in flags between I'll try this code on a few computers to see if I can reproduce it. |
Code alignment seems possible but dubious; these are fairly large benchmarks, and I was able to reproduce the behavior in the original project and the toy project with approximately the same proportion difference in runtime, suggesting there is really something there. I"m definitely not an expert, but I've also been told alignment "can account for up to 10% performance differences" (for instance). 40% seems like an awful lot. My money is on me not using cargo asm correctly, unfortunately (maybe I need to pass some flags, or something). |
@rodya-mirov Can you check if this is fixed on the 0.9 prerelease branch |
@tkaitchuck The problem seems to be much, much worse with that branch. Some measurements I just took on my computer (which is now running MacOS Sonoma): 0.8.6 - 1.87s (3 trials) That is to say, more than a 10x slowdown from the 0.8.6 branch. This is so catastrophically bad I spent some time trying to figure out if I had some something wrong with my ability to use git dependencies, but, I don't think there's a lot of room for error here. My cargo.toml:
|
I dug into the commit history a bit: At revision Then at revision Note I'm using rust 1.76. |
Humm. That is the PR activating AES on arm on stable. I will have to look at the generated assembly. It may be the case that an #[inline] is missing somewhere critical |
I appreciate you prioritizing this. |
There was a pretty serious regression that was missed because the GitHub actions script was actually running on Intel Macs instead on ARM. Fortunately it was never merged to master so there should be no harm. With that fixed, running the above code I do see a perf regression, but it is 15% not 10x. |
Humm, there is some other problem I am seeing now. It is somehow even slower... |
Right this second I don't have a great MVE code for you, although I can link to the github repo: https://github.com/rodya-mirov/twisty/blob/main/src/main.rs
Run
cargo run --release -- skewb
; with the ahash version pinned at 0.8.6, the script finishes in about 3.5s. With the bump to 0.8.7, the script finishes in about 5s. This is, obviously, not great.Under the hood this is basically a stress test for the ahash hashset; the hashed objects are somewhat deeply nested, but everything is Copy (no pointers or anything) and the objects should be 20 bytes, assuming rustc did what I expected it to do. It's generating millions of them, inserting them, and branching on whether or not the inserted object was new.
The correctness is unaffected; that is, I'm getting the same answers before and after; but obviously performance is way down. Since the numbers are unchanging and the other code is the same, I have to assume the issue lies with the ahash changes.
My local environment:
I'm using rust 1.75.0 (stable).
Chip: Apple M1 Pro
OS: macOS Ventura 13.6.2
I can try and trim it down to an MVE if this isn't a known issue and that would be helpful (although the linked code is probably less than 400 lines all told, if you restrict just to the skewb.rs and cubesearch.rs; everything else is dead in this invocation).
The text was updated successfully, but these errors were encountered: