Context:
Code Snippet
Sorry, no snippet to reproduce this. I have a huge proprietary code and have not find the suspicious code in it. I will share it whenever I find it.
Describe the bug
I'm trying to upgrade playwright v0.11.1 to v1.1.1, but found a huge performance loss between v1.0.2 and v1.1.0. Our test becomes about 4x slower.
On local (mac):
On CircleCI (ubuntu):
It seems the new version uses CPU much more than before. Has something internally changed? Is there anyone who has run into similar situation?
For more context:
Thank you for the report. If we fail repoducing it locally, can you help us bisecting it? We will give you a range of Playwright packages and/or Chromium revisions and ask you to run your tests against this range to find the culprit.
The first would be ruling out the upstream (Chromium change). You would point 1.0.2 to Chromium that 1.1.1 uses. It should work and if it is slow, we would know the regression is in Chromium. If it is fast, we would know that the regression is in Playwright. Depending on the result, we would ask you to bisect the range of given Chromium revisions or a range of Playwright revisions.
@jinjor: could you join our slack and ping me in the #general channel?
@jinjor I'll start typing instructions here, but in case you show up on Slack we can continue there.
node_modules/playwright/browsers.json and replace chromium's revision 764964 with 775089: {
"name": "chromium",
"revision": "775089"
}
node ./node_modules/playwright/install.jsThis should install newer Chromium like this:
Downloading chromium v775089 - 125.5 Mb [====================] 100% 0.0s
chromium v775089 downloaded to /Users/pfeldman/Library/Caches/ms-playwright/chromium-775089
Now you have 1.0.2 that runs against new Chromium. Run your tests and tell us if that is slow. If it is, we'll give you Chromium revisions to put there.
Thank you for the instruction 馃槂
@jinjor: could you join our slack and ping me in the #general channel?
Okay, I'll join it when I get ready.
Also, even though you can't share a repro snippet, if you could tell us what your tests do, it might help. For example, if they take a lot of fullPage screenshots, etc.
Another question is whether you are using launch or launchPersistent
Okay.
Also, even though you can't share a repro snippet, if you could tell us what your tests do, it might help. For example, if they take a lot of fullPage screenshots, etc.
Another question is whether you are using launch or launchPersistent
launch
1.0.2 with the newer chromium(775089) was fast, so the slowdown should not be caused by chromium.
Awesome, thank you! Let us prepare a bisect script for you. You probably don't need to run all the tests all the time. With the 4x difference, you could find a test or two that are now much slower and only take tens of seconds to run. That way bisect process will take few minutes altogether.
@aslushnikov ^^
I found a workaround. If Page object is created for each test case, the result gets much better.
Here are some results (all on v1.1.1).
Call context.newPage() and page.close() in every test case:
npm run page-test 536.37s user 84.96s system 105% cpu 9:50.80 total
Reuse Page object through all test cases:
npm run page-test 2591.17s user 223.55s system 200% cpu 23:23.48 total
Oh, you should create entire contexts, not even the pages for each test! @jinjor
Ah nice, thanks. This way should be better for testing too!
So the half of the reason was the usage, but the problem still remains when a long-living page works (maybe something is leaking?). I keep this issue opened for now, but feel free to arrange how you like (change title, open another issue, etc.).
@jinjor we discussed this offline, and one of the thing that might be provoking this is a some long-living waitForSelector command with timeout: 0. Do you have any of these?
No, I did not find any.
FYI: This is not related to v1.0.2 -> v1.1.1 change, but I found that firefox is also slow recently. This workaround does not work on firefox.
Sorry, I haven't tested all the versions between v0.11.1 and v0.17.0 yet (because of breaking changes). I'll update this list when I have time. done
@jinjor do I read this right and v0.11.1 was the last quick version for you?
Yes, I鈥檓 on the way of upgrading from v0.11.1.
@jinjor any updates on this?
I just updated the list of Firefox's cases.
Maybe the previous result was incorrect. Now the regression point is between 1.0.2 and 1.1.1 which is the same as the case of Chromium.
Hey @jinjor,
What's the status of this? Maybe there's another chance for me to see the regression locally? Since you mention that the regression happens with Chromium as well, it might be that we do something unfortunate on the node.js side.
We are still using 1.0.2, have little time to dig into this issue. Sorry.
(I don't know if it is easy to make small test case or not, because it only occurs after a long run.)
We are still using 1.0.2, have little time to dig into this issue. Sorry.
(I don't know if it is easy to make small test case or not, because it only occurs after a long run.)
@jinjor sure, understandable. Let me close this for now since it's not very actionable on our end without a repro.
If/when you have time to get back to this, I'll appreciate if you re-file with details.
Okay, thank you for taking your time!