Re:The "C is Efficient" Language Fallacy (2006)
by lukesandberg on Monday January 09, 2012 @10:02AM
(#3442721)
Well maybe the reason performance improved only slightly is because not a lot of effort has gone into optimizing situations involving restrict pointers because it is so rare. If it is common in fortran it would make sense that a lot of effort has gone into special optimizations for that case, the same effort would not have been spent in c compilers because it is so rare.
[ Parent
| on HN ]
Re:The "C is Efficient" Language Fallacy (2006)
by MichaelSalib on Monday January 09, 2012 @10:20AM
(#3442800)
That might be true, but if so, then everyone below who is claiming 'ZOMG! The article is totally wrong because C99 added restricted pointers!' is wrong.
Also, I find it weird that the C99 committee, which was full of compiler vendors, got so excited about adding a fairly dangerous (and IMHO hard to use correctly) feature to the language without bothering to update their optimisers to make use of it. The only benefit that restricted pointers offer is better optimization; to add support for them without adding better optimization is a complete waste of everyone's time.
Re:The "C is Efficient" Language Fallacy (2006)
by AshleysBrain on Monday January 09, 2012 @10:32AM
(#3442854)
I'm not sure it's as rare as you make it out to be - AFAIK most compilers that support restrict declare malloc() and new to return restrict pointers, so
int *x = malloc(100), *y = malloc(100);
followed by some loop should be able to spot that x and y are not aliased. It should also be able to propagate the restrict as pointers are passed around, at least to some extent.
Re:The "C is Efficient" Language Fallacy (2006)
by lukesandberg on Monday January 09, 2012 @11:40PM
(#3445712)
would the c compiler actually pull that restrict annotation forward without declaring the locals as restrict?