-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
[BUG]: 10x String allocations moving from 0.4.0
to 0.5.0
in recursive loop
#1216
Comments
Do you have the grids.txt file to test with? |
@jackos I think the one here works |
I ran that file on 0.4.0 and 0.5.0 and both took 66 seconds |
@jackos ... No ... I have proofs that 0.4.0 take less than 10s... The goal of my repo, is to test the same algo with différents languages. With 0.5.0, the simplest version is a lot slower, while the others versions are a bit slower (+0.5s) I know that the sudoku.mojo is not optimized or specialized (because it works with strings) With 0.5.0 ... It's a lot slower than python 3... |
more tests here : |
In #1225 you can find the code and |
Thanks @manatlan on my machine I posted results in that ticket which is the same, but @Sharktheone reported results similar to yours. I'll test on Linux VM |
@soraros I've been profiling both versions, and it's doing millions of Having said that, the allocations were close to 1/10th in 0.4.0 compared to 0.5.0, I've been through the involved types and there weren't changes that increase allocations, so there must be some compiler optimization that was lost. We pin to the latest Thanks for raising this is a good test for allocation performance, I'll keep this open until we get performance back to |
0.4.0
to 0.5.0
in recursive loop
@jackos: thank you for the detailed explanation! |
Fyi ... I've got the same algo but specialized to use optimal mojo types: But as you said... The strings version is a good test, in that case, because it's the one which have got the worst perf downgrade from mojo 0.4 to 0.5. (as said, it's now slower than py3) |
FYI ... I will update my repo, to use mojo0.5.0 version (which now use string.find() ...) So the 0.4.0 "sudoku.mojo" (which was a lot faster with mojo0.4 than mojo0.5) will be available here : https://github.com/manatlan/sudoku_resolver/blob/mojo_0.4.0/sudoku.mojo EDIT : I have updated the link in original post to link to this one ^^ |
BTW, just updated my resuts with mojo 0.5.1 ... Mojo 0.5.1 is still the slower ;-( It's EXACTLY the same algorithm, using strings ... and every implementations (java/js/pypy/rust/nim) beats mojo, by far ;-( Same results on github vms ... |
just a ping ... mojo 0.6.1 is still the slowest, in comparison with rust, nim, go, js, java, pypy and codon (and only 2x faster than py3) (Currently, for a python guy ... codon seems to be a better option than mojo) |
Mojo lacks small string optimization. This may be direct cause of these allocations. As jackos states, they are working on fix. @jackos is this indeed related? |
I think yes.
Also, yes (currently; for a python guy), even if this issue is fixed. |
Bug description
mojo 0.5.0 (& 0.5.1 too) / ubu23.10
This mojo code is a lot slower (10x) with the new 0.5.0, than the good old 0.4.0.
The text was updated successfully, but these errors were encountered: