Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

98
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!