Rethinking optimization for size
Posted Feb 10, 2013 11:34 UTC (Sun) by khim
In reply to: Rethinking optimization for size
Parent article: Rethinking optimization for size
I can't think of any possible reason that converting array index operations into pointer arithmetic is ever a win.
It may be a win because to access data using an index you need two variables (array address and index) but to access data using pointer you need one (just pointer is enough). When callbacks are involved it may replace code which uses just registers to pass information around with code which uses structure in memory - in this case wins can be substantial (speaking from experience). But of course such cases are rare.
But you are saying that conversion to pointer arithmetic is somehow bad? In my experience it's usually net neutral. What kind of optimization compiler can apply if I'm using indexes? How often it can apply them? I'm not saying it never happens, I just don't see and a common occurrence.
to post comments)