4 ms·
Disclaimer: I do not understand enough of the code and of the domain. The code itself looks slow and barely readable. A lot of for loops, few named functions.
by gorg_dc 5y ago
Disclaimer: I do not understand enough of the code and of the domain.
The code itself looks slow and barely readable. A lot of for loops, few named functions. It needs a very strong refactoring to work properly with numpy. That should be done first, instead of pulling up the RuStIsFast card. It is not surprising that the results were not so great as expected.
In general, the article is too long to be properly understood...
- cogman10 5y agoAgreed. But also, there were a few missed optimizations. The most obvious (to me) is the constant indexing into pigs. It was hit on in the article (and gave a 25% increase in speed), yet I don't think the author went far enough in elimination. Pushing the pig_j lookup up into the "for j" scope instead of computing it on each inner loop would have likely saved a large number of the lookups. In fact, I'd guess that'd be one of the optimizations that rust pulls out. Python is far less likely to pull those sorts of optimizations.
- Twirrim 5y agoI did a double take at that section, the text implied they'd spotted that one, and shifted the look up, and I was trying to figure out if they'd shared the wrong bit of code and assumed they had. But after seeing your comment and re-reading that passage I'm not sure they did.
- deleted 5y ago[deleted]