Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged

Conversation

Sebastian-Webster
Copy link
Contributor

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:
  • Version is supported by Puppeteer (the previously used version is now deprecated)
  • Fixes stability issues in Ubuntu 22.04 and newer
  • The downloaded version of Google Chrome on Apple Silicon Macs is now ARM-based, increasing performance and removing the need for the Rosetta translation layer
  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:

  • Wait for page load
  • Wait for network requests to finish
  • Wait for all intervals in the page to be cleared
  • Wait for all timeouts in the page to expire
  • Wait for the chart animation to finish
  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:

  • Machine 1 - 90s
  • Machine 2 - 100s
  • Machine 3 - 89s

After PR:

  • Machine 1 - 32s
  • Machine 2 - 64s
  • Machine 3 - 40s

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • New and existing unit tests pass locally with my changes

@junedchhipa junedchhipa merged commit c227248 into apexcharts:main Jun 13, 2024
@Sebastian-Webster Sebastian-Webster mentioned this pull request Jul 6, 2024
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants