<div dir="auto"><div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">James Richters via fpc-pascal <<a href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a>> schrieb am Mi., 9. Nov. 2022, 13:47:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">In other words.. is<br>
<br>
A:=(B+C/D)-E^F;<br>
G:=H*(I+J);<br>
K:=L+M/N;<br>
O:= A+G-K;<br>
<br>
Less efficient than<br>
O:= ((B+C/D)-E^F)+ (H*(I+J))-(L+M/N);<br>
<br>
Or does it end up being the same when it's done?<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">The compiler will insert temporary variables anyway when necessary (so even your first example might infact contain more variables and your second will very likely contain temporaries).</div><div dir="auto">Using optimizations (especially regvars, used by default in -O2) might improve this independent of whether you use variables yourself or not. </div><div dir="auto"><br></div><div dir="auto">But in general: you should look at other things to optimize and only come back to this when you have nothing easier to improve. </div><div dir="auto"><br></div><div dir="auto">Regards, </div><div dir="auto">Sven </div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote></div></div></div>