<div dir="ltr"><div dir="ltr">On Sat, Oct 26, 2019 at 1:31 PM Florian Klämpfl <<a href="mailto:florian@freepascal.org">florian@freepascal.org</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">This is imo a waste of time and clutters only code. It is much more beneficial to <br>
improve the compiler to avoid a copying of the variable if it can prove <br>
that it is not needed (or to improve auto inlining.)<br></blockquote><div><br></div><div>While I absolutely agree that it would be nice if FPC auto-inlined *by default*, as most compilers do (*without* the {$AUTOINLINE} optimization directive that essentially nobody knows exists and thus never uses anyways), FPC doesn't do so currently, and as far as I can tell probably won't in the foreseeable future.</div><div><br></div><div>At risk of sounding overly abrasive or rude, there is *enormous* amounts of code in both the RTL and packages that is almost unusably slow due to what seems like a general lack of *any kind* of concern for performance. </div><div><br></div><div>Far too much of it is just un-inlined heap allocation on top of un-inlined heap allocation on top of un-inlined heap-allocation on top of for-loop that uses "Integer" when it should really use "SizeInt" on top of utter avoidance of pointer arithmetic even though it's always faster on top of methods that have no reason to be marked "virtual" but are anyways on top of blah blah blah... I'm sure you get the point. </div><div><br></div><div>And of course I haven't even mentioned the fact that in reality, *anywhere* that an advanced record (or even object) can be used instead of a class, it should be, because it means you're avoiding an unnecessary allocation, but good luck convincing anyone who matters of that!</div><div><br></div><div>I'm sure you get my point.</div><div><br></div><div>And no, I'm not advocating for "micro-optimization", or as I constantly hear "stuff that doesn't matter except in contrived benchmarks", I'm advocating for the bare minimum standards that average people would and do expect from the "standard" library and packages of a modern programming language.</div><div><br></div><div>People are of course free to pretend like it doesn't matter that *each and every* use of the "inline" modifier in the Classes unit is hidden behind a "CLASSESINLINE" define never set to true in any makefile (which yes, indeed mean that absolutely nothing in Classes is inlined, under any circumstances, ever!) but I at the same time am free to realize that incurring the cost of *two* function calls for every single indexed access to a TFPList instead of zero via inlining is utterly insane, and modify my local makefiles to define CLASSESINLINE.</div><div></div></div></div>