Re: [fpc-devel] Merging identical procedure proposals

2021-10-16 Thread José Mejuto via fpc-devel
El 16/10/2021 a las 21:57, J. Gareth Moreton via fpc-devel escribió: Certainly possible, and would address the whole function pointer thing, although I do question the performance hit because of the extra jump, especially for small procedures, as well as the fact that the function overhead

Re: [fpc-devel] Merging identical procedure proposals

2021-10-16 Thread J. Gareth Moreton via fpc-devel
Certainly possible, and would address the whole function pointer thing, although I do question the performance hit because of the extra jump, especially for small procedures, as well as the fact that the function overhead would still be present.  Certainly a safe start though. Gareth aka. Kit

Re: [fpc-devel] Merging identical procedure proposals

2021-10-16 Thread Yuriy Sydorov via fpc-devel
On 16.10.2021 21:45, J. Gareth Moreton via fpc-devel wrote: I figured that virtual methods would be no-go and that this would only apply to static methods.  It seems a shame to dismiss it completely though because there's a huge number of procedures that compile to the same code, especially

Re: [fpc-devel] Merging identical procedure proposals

2021-10-16 Thread J. Gareth Moreton via fpc-devel
I figured that virtual methods would be no-go and that this would only apply to static methods.  It seems a shame to dismiss it completely though because there's a huge number of procedures that compile to the same code, especially when generics come into play, and I have identified a fair

Re: [fpc-devel] Merging identical procedure proposals

2021-10-16 Thread J. Gareth Moreton via fpc-devel
Sounds like "procvar = @myproc" would be -O4 at best due to the side-effects, otherwise I would wonder if it's possible to track such references, especially with units that are pre-compiled. Gareth aka. Kit On 16/10/2021 15:32, Jonas Maebe via fpc-devel wrote: On 13/10/2021 19:33, J. Gareth

Re: [fpc-devel] Merging identical procedure proposals

2021-10-16 Thread Jonas Maebe via fpc-devel
On 13/10/2021 19:33, J. Gareth Moreton via fpc-devel wrote: I figure this would be a whole-program optimization though due to inter-unit calls and comparisons and the like. Usually this is an optimisation that is performed at link-time because you don't need any compiler-level information for

Re: [fpc-devel] Merging identical procedure proposals

2021-10-16 Thread Benito van der Zander via fpc-devel
Hi,  that is a great idea It especially useful for generics, where each specialization can create a huge amount of identical methods Best, Benito On 13.10.21 19:33, J. Gareth Moreton via fpc-devel wrote: Hi everyone, So one optimisation that has cropped up a couple of times is finding

[fpc-devel] Merging identical procedure proposals

2021-10-13 Thread J. Gareth Moreton via fpc-devel
Hi everyone, So one optimisation that has cropped up a couple of times is finding ways to merge subroutines that, while containing different source code, compile into the exact same assembly language.  For example, TStream.WriteData has implementations for numerous input types, and the