On Sat, Oct 26, 2019 at 1:31 PM Florian Klämpfl <flor...@freepascal.org>

> This is imo a waste of time and clutters only code. It is much more
> beneficial to
> improve the compiler to avoid a copying of the variable if it can prove
> that it is not needed (or to improve auto inlining.)

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.

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.

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.

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!

I'm sure you get my point.

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

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.
fpc-devel maillist  -  fpc-devel@lists.freepascal.org

Reply via email to