[fpc-pascal] 3123 inherited not supported inside inline

Michael Van Canneyt michael at freepascal.org
Sun Jun 25 09:20:53 CEST 2023



On Sun, 25 Jun 2023, Hairy Pixels via fpc-pascal wrote:

>
>
>> On Jun 24, 2023, at 10:27 PM, Michael Van Canneyt via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:
>>
>> It seems to me no gain is to be had from e.g. inlining a routine of 500+ lines
>> of code.
>
> What if the function was only called from 3 places in the program and each
> one of those was in something with very long loops, say 1 million
> iterations?  If you inline you'd get only an extra 1000 lines of code size
> but save 3 million function calls which could be a big savings.

I doubt there will be any gain: 500 lines of code will result in many
thousands of assembler instructions being executed 3 million times.

The few additional instructions generated by a function call are dwarfed by
that.

More importantly: Inline is an automatism to optimize where possible.

You can always find exceptional cases which will not be handled by an
automatism. They are irrelevant. It's the bulk of cases that needs to be
solved by automatisms.

Michael.


More information about the fpc-pascal mailing list