fontoxpath icon indicating copy to clipboard operation
fontoxpath copied to clipboard

Remove strings from the compiler and internal AST to reduce bundle format

Open DrRataplan opened this issue 4 years ago • 0 comments
trafficstars

Right now, we use a bunch of string literals in the parser. We should be able to replace those with for example numbers.

I'm thinking of something like this:

Inject an object that maps all AST nodes to a number and make sure the closure compiler inlines those numbers. In the compiler, use the same object to traverse the AST in a logical way.

For the parseExpression function, we will still need the expanded human readable names, but that will reduce the repetition of those names in both the parser and the AST to only one central place.

Before integrating, make sure that the total binary size actually decreases! Especially compression already cause the duplicated strings to impact the binary size not that much.

DrRataplan avatar Apr 22 '21 19:04 DrRataplan