2 ms·
Agreed. 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
by cogman10 5y ago
Agreed. 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.