Hacker News new | ask | show | jobs
by dahfizz 1302 days ago
> autovectorizing is broken by bounds checks

This is the big one. You pay a 50% penalty for actual CPU bound, iteration heavy code with bounds checking enabled.

https://github.com/matklad/bounds-check-cost

2 comments

The proper way of addressing that is to manually hoist bound checks out of "hot" loops. Not just remove them altogether.
This should be the article.

Running this with 1.65 on an Intel 12400 gets a nearly 4x speedup when bounds checking is not needed. Just wow.

Bounds checking avoidance is important when it becomes a significant chunk of your hot-path.