On 09/11/15 10:19, Mattias Gaertner wrote: > The above three are not the same. > > The second version executes the With-Expression multiple times, so > unless the compiler optimizes a lot it will create more code and will be > slower. > > The first and third versions have the same amount of reads/writes and > with optimizations (-O2 or higher) create the same assembler code. > Without optimizations the first is a bit faster, because the compiler > stores the With-Pointer in a register, while in third version it stores > it on the stack. > > >> (but then, the last form, will have the variable declared explicitly, which >> probably means more complicated code around this region etc.?) > > A local variable is bread and butter for the compiler. There is > nothing complicated about it. > I would argue that giving an expression a describing name can make code > less complicated. > > Mattias >
Thanks, I believe, this should be added into the docs somewhere ;) if it's not already there. el es -- _______________________________________________ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus