-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Performance impact of jsdom 23.2.0
#3659
Comments
Seeing even more dramatic impact on one of our test suites using RTL and mocha: jsdom
jsdom
That's 12x time spent (and the timeouts). |
Thanks both for your reports. It looks likely that we'll have to revert. /cc @asamuzaK If either of you are able to produce public repro cases, as standalone repositories that we can clone and run, I imagine that will make our work on reintroducing the selection engine in the future easier. |
Sorry for the inconvenience. |
I started looking at a repro but in my case I don't believe it will add anything new - in |
My tests are also failing due to TypeError since
|
The performance regression is actually significant, at least for my uses, running on around 14 cores:
|
Any repros would still be useful. We need to know what sorts of cases are slower, so we can optimize them.
A repro would be extremely helpful.
Can you provide any test cases so we can profile this performance regression and speed up the slow parts? |
I've published [email protected] for testing purpose. Latest benchmark results:
If you can help, could you please add the following to package.json and test it? package.json: overrides: {
"@asamuzakjp/dom-selector": "2.0.2-a.2"
} Or directly install: npm i @asamuzakjp/dom-selector@next |
Ran this a couple of times, shaves around a second off the time, going from 30s to 29s. It does however introduce something new, which looks like a regression:
const lists = await screen.findAllByRole('list');
expect(lists).toHaveLength(3);
expect(await within(lists[1]).findByText('Home')).toBeInTheDocument();
expect(await within(lists[2]).findByText('Administration')).toBeInTheDocument(); It seems like |
Thanks for the catch. |
We observed a roughly 40% increase in execution time in our tests after upgrading to v23.2.0. Some tests even timed out. |
Are you able to provide sample code we can use to reproduce and fix this regression? |
So far, none of the reporters here have been able to invest the time in creating a benchmark we can use for the future. (I don't even demand a standalone repro that uses only jsdom; a whole GitHub repository with whatever testing frameworks would be enough!) Given this, I'm planning not to revert for now. Reverting without such a benchmark would mean we have no ability to judge when dom-selector is safe to reintroduce in the future, and so would set us up for a painful cycle of dom-selector (which has more capabilities, which people might depend on, as seen in e.g. #3618 (comment)) -> nwmatcher (which is faster but more broken), back and forth, based purely on anecdotes. If people are interested in getting jsdom back to its 23.1.0 performance (at the loss of its new selector capabilities), then please set up a benchmark repository. The more minimal the better, and if it can be done as a pull request against https://github.com/jsdom/jsdom/tree/main/benchmark/selectors, that'd be ideal. If we get one or two such benchmarks, then I'll spend the time on reverting. |
Sorry, I initially thought you were asking for a minimal reproduction, which I haven't had time to build. The performance regression I've noticed originates from a public repository: https://github.com/ariakit/ariakit. Here's the PR where jsdom is getting updated: ariakit/ariakit#3336 The following link shows an instance of tests failing due to timeout: https://github.com/ariakit/ariakit/actions/runs/7511045254/job/20450195794?pr=3336#step:6:83 As you can see, the tests require 325 seconds to finish. For comparison, here's an instance of tests from the main branch, where jsdom 23.1.0 is in use: https://github.com/ariakit/ariakit/actions/runs/7510618416/job/20449247363#step:6:73 In this case, the tests are completed in 216 seconds. |
In https://github.com/adazzle/react-data-grid
This will run the With jsdom 23.1.0:
With jsdom 23.2.0 +
|
* feat: initial vitest setup * feat: starting on shared component tests * feat: add testing library linting * feat: add jest dom linting * feat: shared components tests * feat: tests for nav component/leaf * refactor: exclude wasm dir from coverage * fix: styled components dropping types - on 6.1.6 seeing issues similar to: - styled-components/styled-components#4062 - mui/material-ui#15695 - downgrades styled-components * fix: update styled components, proper rnd prop passing - sourced from: https://stackoverflow.com/a/76623553 - had issues with function parameter prop inference with >6.1.1 * refactor: exclude test dir from coverage - not necessary * feat: modal body and footer tests * feat: include test files when using eslint * feat: wrap all context access, more tests, mocking strategy - not sure if im sold on how I'm mocking so far, but this is food for thought - seems like this may be the best way for me to interact with the global context in tests * feat: exclude files from coverage - maybe use include if this list grows any more * feat: tests for context access wrapper * feat: virtual controls form tests - tentative impl for tests using media queries - package updates - snapshot updates due to styled components update * refactor: fix spy/mock reset, virtual controls render initlal values from storage if provided * feat: keybindings form spec * feat: download save spec - fixes download mime type - remove dynamic anchor - adds tests * feat: local local rom spec * feat: testing package updates * refactor: define env vars in .d.ts * feat: navigation menu spec, add msw - adds navigation menu tests - adds msw - adds auth provider to render with context * feat: bump msw * feat: load rom/save specs * feat: upload/rom save to server specs * feat: login form spec * feat: file system modal spec * feat: modal container spec - modal container spec - bumps testing deps * feat: pwa prompt spec * chore: periodic package updates * refactor: keybindings form validation assertions * refactor: aria label case * feat: save states spec * chore: dedupe packages * fix: jsdom latency - see: jsdom/jsdom#3659 * feat: controls modal spec * refactor: use testing selector * feat: cheats spec - todo: tentatively refactor all tour tests - may want to test for # of steps * feat: upload file modal specs * chore: testing package updates * chore: update test deps * feat: screen spec - additional readme update * chore: testing package updates * refactor: screen initial bounds test * refactor: screen validate gripper handles * refactor: screen rename tests * refactor: remove explicit timeout * feat: control panel spec, accessible buttons - control panel spec - accessible buttons - remove unnecessary props - fix aria labels --------- Co-authored-by: Nick VanCise
Basic info:
21.4.0
23.2.0
Minimal reproduction case
23.1.0
(mm:ss):23.2.0
(mm:ss):The hit to performance in
23.2.0
is quite significant, to the point that a handful of our unit tests doing no more than clicking and selecting using RTL are consistently timing out too nowI wanted to raise this as an issue as requested in the release notes for
23.2.0
How does similar code behave in browsers?
N/A
The text was updated successfully, but these errors were encountered: