-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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: add e2e tests for load and typing time #14506
Conversation
Is there a way we could automate this across versions. Like have a shell script that checkout old tags, runs this test and produce a table at the end? |
Can we test in a post with images, quotes... like this one for instance https://waitbutwhy.com/2017/04/neuralink.html |
} from '@wordpress/e2e-test-utils'; | ||
|
||
describe( 'Performance', async () => { | ||
it( '1000 paragraphs', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want it to be executed every time we run e2e tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, let's exclude.
@youknowriad I tried checking out other tags and running the tests, the only problem is that the tests don't exist in the working directory then. Not sure how to solve it. I can try copying the file, then writing it for each tag. |
@ellatrix I was thinking we use the exact same test in several checkouts:
|
I'm slowly giving up on this :( Always keep running into vague errors
What I was trying:
|
It's a good start. Other persons could chime-in and try to improve things. |
|
Had to tweak some files to test the other versions:
|
Re: #14506 (comment) I'd imagine the warning may be a result of the recent Jest version upgrade, since your script does not account for the need to run |
@aduth Thanks :) I figured it out while manually checking out the tags and running the tests. Still, the whole idea is kind of flawed, as it only works back to 4.9.0. Earlier there wasn't a separate e2e package. It would be better to do something like @youknowriad suggested, but it doesn't seem like a small task. The current PR is still useable though, we can run it for every version we release. I ran it back until 4.7.0 as you can see above. the results look good: 4.7.0 was very slow, we made some small improvements for 4.8.0, then 4.9.0 is significantly faster thanks to @youknowriad's PR, performance decreased again with 5.2.0, but |
I wonder if there'd be some value in having a job dedicated to performance regression in travis? So for instance if the variance is +100ms or something then the job would fail. That might help catch pulls that significantly impact performance? I'm not sure offhand how this would work, but presumably there would need to be some service that marks/saves the current performance metrics on the master branch as the baseline for pulls (then maybe those metrics could be a simple json object saved to a file in the repo? - or amazon s3)? (note, I'm not suggesting my idea block this pull getting merged, more of an iteration that might be something that could be explored). |
@nerrad Yeah, that would be cool. It would require the performance test to run all the time as well, probably best as a separate job. We can keep a file with the times to test against, hopefully lowering them as performance improvements are made. |
I can help with the follow-up PR if we decide to integrate it with Travis. We would have to find a way to put this benchmark into its own Jest run (maybe with projects feature?). |
These branches can be used for 4.7 and 4.8: v4.7.0...test/performance-4-7 They require the files to be moved. You can't just stash and checkout a different release. Would be good to create a solution that can just install any Gutenberg version and run the tests, but at the moment I like to spend my time on other things (I don't think it's a trivial thing to do). Anyone is free to try of course. |
I pushed a commit to be able to run the performance test using a simple CLI script
I think we should merge this branch. My last question is should we keep the "neuralink" post or replace it with a similar lipsum post in terms of content/blocks (thinking about copyright) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good, there might be one tweak necessary to the existing e2e test config
packages/e2e-tests/jest.config.js
Outdated
testPathIgnorePatterns: [ | ||
'e2e-tests/specs/performance.test.js', | ||
], | ||
reporters: [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this reporter to be included in here?
If I understand the issue here to be the need to stash new files, you can pass the
https://stackoverflow.com/questions/835501/how-do-you-stash-an-untracked-file |
Co-Authored-By: youknowriad <benguella@gmail.com>
e1c05b2
to
a50569a
Compare
I think we should merge this branch. I keep looking for it to run performance tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, let's get it in 👍
@@ -9,4 +9,7 @@ module.exports = { | |||
'@wordpress/jest-puppeteer-axe', | |||
'expect-puppeteer', | |||
], | |||
testPathIgnorePatterns: [ | |||
'e2e-tests/specs/performance.test.js', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we put it into its own folder to avoid this ignore rule?
e2e-tests/benchmark/index.js
- should do the trick
I've pushed an alternate test fixture document, ideally roughly equivalent in stress testing a variety of different contents (headers, lists, quotes, paragraphs, images, inline formats), randomly generated with a combination of loripsum.net and manual insertion of images from placeholder.com.
|
I noticed that with the recent changes, running the performance tests is a lot slower even if the results are similar. I wonder if it's because of the time needed to load the images. I don't think this should stop us from landing the PR but it would be good to mock these or load local images. |
We could consider using |
Description
Adds some simple tests to report the average load and typing times.
Example:
Why? It is more accurate than trying to record key presses at random places in a big post. It's also possible to test with different content. Note that speed can still vary depending on a number of environmental factors, but at least some things are now constant.
The tests are done with a 1000 paragraph post, where each paragraph contains 200 characters. Maybe additional tests should be made with more diverse content, but I think this is a good start.
For load times, 10 samples are taken. For typing speed 200 samples are taken (typing one full paragraph).
The typing time includes everything Puppeteer is executing during
page.keyboard.type
, so, in reality, it is probably less. We can try to look atkeyup
andkeydown
events instead.How has this been tested?
Screenshots
Types of changes
Checklist: