Timon Gehr:

> AAs are built-in. The optimization you describe is quite easily carried 
> out by the compiler. And I am quite sure that in the long run, it will 
> bite us.

With the LDC compiler if you perform an AA lookup, and after one or few lines 
you do it again, (because you are using an if and you are not using the pointer 
nature of the return value of "in AA"), LDC most times uses a single AA lookup.

This little group of optimizations were added to LDC just to improve AA usage. 
With such simple optimizations I think 99% of times you don't need "in AA" to 
return a pointer. So probably returning a bool is enough. I don't think I have 
ever stored the return pointer of "in AA", I have used it locally, just to save 
one AA lookup.

Bye,
bearophile

Reply via email to