The code that Terser produces for my project contains many calls to the Javascript Math
object and I am wondering if there is an easy way to minify these calls.
Here is a screenshot of part of the minfied code with Math
highlighted (altogether there are almost a thousand calls to Math
):
I could certainly do the optimization in my original code by setting const min = Math.min
etc, but this would be hard to maintain and generally an abominal micro optimization.
As I see it properties
in the mangle options cannot be used for this, as properties
explicitly will NOT work for built-in Javascript properties.
Does anybody have an idea how calls to Math
, Number
, etc. can be minified with Terser?
I could not find a solution for this using Terser.
BUT I came to the conclusion, that it would not make much sense to minify all calls to
Math
for the following reasons:So in conclusion this seems to be neither possible nor necessary.