[Pas2js] DCE tool feature

Mattias Gaertner nc-gaertnma at netcologne.de
Tue Feb 12 21:51:31 CET 2019


On Tue, 12 Feb 2019 20:05:07 +0100 (CET)
Michael Van Canneyt <michael at freepascal.org> wrote:

>[...]
> > Pas2js could include an experimental feature called DCE (dead code
> > elimination) tool. This tool allows to strip out unused properties,
> > functions from the static RTL

This is already on the optimization request list under "move
rtl.js functions to system.pp and let the WPO decide if they are
needed":
http://wiki.freepascal.org/Pas2js_optimizations#Feature_requests


> > and the classes from the generated JS.

Already implemented since two years.


> > Running DCE takes a bit of extra time each build, and the output
> > size does not matter during development, but I think important at
> > production to get a small bundle JS possible. 

Size does matter for webapps.

>[...]
> The only exception is that if you have published sections,

DCE usually refers to dead statements as well, like "if false then dead"
and empty functions. See feature requests:
* -O2 removeemptyprocs
* -O2 skip dead code If(false){...}


>[...]

Mattias


More information about the Pas2js mailing list