apexcharts / apexcharts.js

📊 Interactive JavaScript Charts built on SVG
https://apexcharts.com
MIT License
14.03k stars 1.28k forks source link

perf(tests): improved e2e test performance by up to 3x #4515

Closed Sebastian-Webster closed 3 weeks ago

Sebastian-Webster commented 3 weeks ago

Improved end-to-end test performance by up to 3x

Changes:

  1. Upgraded puppeteer to latest (22.10.0 as of writing) and puppeteer-cluster to latest (0.24.0 as of writing). The benefits of this I found are:
  1. Concurrency limit for puppeteer-cluster is set to os.availableParallelism(), allowing computers with more CPU cores to take advantage of the available compute and putting less load on computers with less than 5 cores

  2. When running tests, Puppeteer no longer waits a hard-coded amount of time (previously 2,200ms). It now waits in this order:

  1. Updated line/realtime test to only run the interval twice (it only ran twice before this PR, it ran every 1000ms in a 2,200ms window, but now that Puppeteer is waiting for intervals to be cleared, a limit needed to be set to prevent Puppeteer from timing out)

  2. In the new version of Puppeteer, page.waitFor() is no longer a function. The page.waitFor() in tests/e2e/spec/utils.js has been replaced with a promisified timeout.

  3. In the new version of Puppeteer, the filepath for the install Chrome file is now node_modules/puppeteer/install.mjs instead of node_modules/puppeteer/install.js. This filepath change has been made to the CONTRIBUTING.md file.

  4. Changed puppeteer-cluster concurrency from CONCURRENCY_PAGE to CONCURRENCY_BROWSER to fix various issues with concurrency after the Puppeteer upgrade

Benchmarks:

Machine 1 - M2 2023 15 inch MacBook Air 8GB Memory Machine 2 - 6 core 2.6GHz i7 2019 16 inch MacBook Pro 32GB memory Machine 3 - M1 2021 24 inch iMac 16GB memory Before PR:

After PR:

Type of change

Checklist: