On Sat, 9 Nov 2019, J. Gareth Moreton wrote:
I tend to think more size gains can be obtained from more aggressive
smartlinking.
The smartlinking is sometimes disabled by the way code is written.
To give an example, pas2js has a switch to convert published to public
sections. As a result, the published sections are suddenly reduced to
what is actually used in code. This produces significant size gains.
Michael.
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
That's true. That's mentioned in the "size matters" article. I didn't
know about 'published' until then. Presumably, if that switch doesn't
exist (like with most of the LCL), I gather the only way to strip out
those unused published sections is some very intelligent whole-program
optimisation, and even then it may not work if a string (to access a
property name) is not deterministic.
WPO will not cut it, since the properties are usually loaded from a stream
which can be an external file or a resource. You simply do not know and have
no way to know. That is why all published variables are always kept.
Michael.
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel