Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

100
Vistas
Chrome and Firefox JavaScript execution caching behavior

I am working on a web application that involves doing a some computation with JavaScript. In a benchmark test, I found Chrome is significantly faster than Firefox in term of execution time. When I run with the built in performance analysis tool in both browsers, I found that Firefox spent a lot of time on this function whereas Chrome does not.

// compute n choose k
function choose(n, k) {
  k = Math.min(n - k, k);
  let res = 1;
  for (let i = 1; i <= k; i++) {
    res *= n - k + i;
    res /= i;
  }
  return res;
}

Given that my application will invoke this function in the order of magnitude of 10^7 times each with n <= 40 and k <= 10 during the benchmark, I suspect that Chrome's JavaScript engine will cache the result of this function (since it's deterministic and has no side effect) whereas Firefox does not. However, I am not familiar enough with the internals of those 2 JavaScript engine to be sure. It's appreciated if someone can provide more detailed explanation.

In addition, how should I change my code or browser settings to make it run faster on Firefox?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda