Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

408
Visualizações
Minify calls to Math, Number, etc. with Terser

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):

enter image description here

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?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

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:

  • Obfuscation does not really improve. The mapping would be visible inside the file, so unmapping would be very easy for anyone determined to unobfuscate the code.
  • File size may be smaller, but since files are sent gzipped over the internet, the actual difference would be very small or none, since multiple string occurences like calls to 'Math' will be compressed by gzipping.

So in conclusion this seems to be neither possible nor necessary.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda