Open dnknn opened 3 years ago
🗣 Using Violentmonkey as the script container, there is no problem, which means that there is no problem with the script code.
Install 3 scripts : or Violentmonkey scripts_test.zip https://greasyfork.org/scripts/372673 https://greasyfork.org/scripts/381682 https://greasyfork.org/scripts/4255
Page to test performance : https://item.taobao.com/item.htm?id=602809430649
Violentmonkey
: hardly any impact.Even if I export more than 100 scripts from Tampermonkey and then import them to Violentmonkey, after testing, Violentmonkey has almost no impact on the performance of the page.
With 3 scripts enabled, there is almost no impact on performance, and the loading completion time is only 0.3s
longer (1.25s -> 1.55s)
@derjanb
Under the same test environment, use Tampermonkey
as a script container, Tampermonkey will cause page performance crash, high CPU usage, Once encounter a page like this that causes performance, all pages cannot respond to network requests, and the page cannot be opened in a short time.
Tampermonkey
: fatal impact -_-⚠: The test here only installs 3 scripts, and the speed affects 2s
(1.25s -> 3.1s). If the user installs ⩾ dozens of scripts (but not enabled), it will take at least 30s
to respond at this time, and the page will crash during the period, and other pages will not be opened. .
So I hope that the most deadly root cause can be investigated, and it can be perfectly fixed!
I even forgot, recommend a perfect open source & lightweight extension, a very useful/convenient testing tool:
This time value is consistent with the time in DevTools.
The same test environment, the same number of scripts and the number of runs.
I hope to find out the root cause of Tampermonkey's performance degradation and finally fix this problem. Thank you very much!!!
@derjanb Hello!
I don't know if you confirm the fatal problem?
Can you investigate the root cause of this fatal problem in depth? This problem is very serious, it affects normal use too much ...... -_-
Should be fixed at the latest BETA version which will be published at the Chrome Web Store after review.
Should be fixed at the latest BETA version
@derjanb First, thanks very much for your contribution in the fixed works, when I saw your reply message, I was very happy, I also looked at the update log. But.....no...no......no.... I was disappointed after the test...this very very fatal/serious problems still exist... Please see picture below, it is very intuitive to see the severity/fatality of the problem.
The original speed of this page is actually
⩽1s
when opened under the cache, before, under DevTools \<Network> opened , it will affect about 0.3s.
From the perspective of page completion time alone, from 1.0s
to 21s
, this problem is very serious.
For comparison, Violentmonkey's time is 1.3s
(extending 300ms is normal) (working 10 of 200 UserJS ).
ps: Violentmonkey's time may also be
1.1s
or1.2s
(I did not test Violentmonkey again this time, but was a complete test before.) so obviously the UserJS code itself has no performance issues.
⚠Please Note⚠: You must be enough scripts (dozens or ≋ 200) to reproduce the problem.
1) Helper/assistant: Page load time chrome.google.com/webstore/ (very convenient to view page/DOM time)
2) Test page: https://item.taobao.com/item.htm?id=602809430649
ps: This page is the most influential page I know,
21s
, so it is the best test sample. There are also many other pages that will be affected by performance, but it may be extended by about3s
,5s
, or10s
.
3) You must be enough scripts (e.g. dozens or ≋ 200) to reproduce the problem (You can find the 100 scripts I sent you before in your mailbox)
4) Reproduce this 21s
fatal performance problem.....-_-
The latest version seems to have improved a little: if it is the above 3 UserJS, the page time is
≋2.2s
, but it extended by1.2s
, which is obviously problematic. But if your Tampermonkey has a sufficient number of scripts, then this time impact will be significantly extended, such as21s
!!! -_-PS: personal point of view: the features of Tampermonkey is already very powerful, so I think the focus of works should be on the direction of improving performance.
⩽1.5
at most (i.e. 1.0s->1.5s)sorry for my English.......I don't know if you can understand the meaning....
In addition, the scripts cannot be really excluded (e.g. // @exclude
) of bugs, I haven't tested it carefully, if there are any problems, I will tell you.
Hi, @derjanb !
- I have encountered this serious problem on quite a few pages: the opening is slow, or even almost impossible to open, which makes me very sad. Even if UserJS is not enabled or only three or two are enabled on these pages, it is still the same problem. If I disable Tampermonkey or using Violentmonkey, the page opens successfully in an instant.
In these pages, enable Tampermonkey, and then even if all UserJS in Tampermonkey is disabled, it still opens slowly (or cannot be opened).
This shows that there are 2 logical problems:
js
itself has no performance problems), it will have almost no impact on the page.So, can you give priority to investigating this big problem? Because currently Tampermonkey will not only cause some normal pages to fail to open, but also the CPU utilization rate will increase rapidly, and then any other pages will not be able to be opened in a short time. (If you want to be short (The only way to open other pages within time is to disable Tampermonkey and then enable)
Yes, this message persists for 5 minutes even if the script is deleted in the meantime. However, the script is not executed or even considered for execution anymore.
So yes, there is a problem, but only a cosmetic one.
@derjanb I guess that the fatal problem of this issue may be related to this problem 👇 ?
I often encounter the problem of @exclude
or @include
,
For example: https://regex101.com/r/olMOpR/latest
// @include /(?:greasyfork|sleazyfork).org/.*/
// @include /.*greasyfork.org.*/
// @include /greasyfork.org/
// @noframes
cannot be excluded// @noframes
❌ invalid
// @exclude *reg.163.com/*
// @exclude *mail.163.com/*
❌ invalid
In the end, it still prompts that the script has been executed 6 times
This code can quickly copy the URLs of all iframes embedded in the top page
// Copy all iframeURL let ifrSrc = []; top.document.querySelectorAll(`iframe:not([src='about:blank'])`).forEach(fE =>{ ifrSrc.push(fE.src); }); ifrSrc=Array.from(new Set(ifrSrc)); copy(ifrSrc.join(`\n`)+`\n`); console.log(`✔️copied: `+ifrSrc.length +` iframeURLs`);
Should be fixed at 5.3.6205 (crx|xpi in review)
Please download the crx file linked above and drag and drop it to the extensions page chrome://extensions
(after you've enabled 'Developer Mode').
For a quick fix please export your settings and scripts as zip or (JSON) file at the "Utilities" tab and import it back at the fixed BETA version.
💥 2 fatal problems caused by using Tampermonkey as UserJS/scripts container :
①. On some pages, it will cause a significant performance drop (very high CPU-usage), and some even crash (it takes ⩾8s~90s to complete load ), during this period, other normal pages will also fail to open. ②. On some pages, scripts cannot be excluded(
// @exclude
) at all, even the script is disabled, and even delete to the trash/recycle-bin, still cannot be ruled out.The above two problems should be directly related. can skip this floor and look directly at the test example below and the test comparison of Violentmonkey :
👉 https://github.com/Tampermonkey/tampermonkey/issues/1187#issuecomment-804521668 👉 https://github.com/Tampermonkey/tampermonkey/issues/1187#issuecomment-805264334 👉 https://github.com/Tampermonkey/tampermonkey/issues/1187#issuecomment-812256520
🗣 important statement:
The root cause is: It is completely impossible to prevent the script from being executed on a certain page, so:
For example:
Then I tried to exclude the script not working on this page, but the results are all invalid...
*taobao*
Yes, I also added the URL of the iframe, but still cannot be ruled out.
/.*(?:aliapp|alibaba|alicdn|aliyun|aliyuncs|effirst|mmstat|tbcdn).+/
So I tried to disable/OFF the script, but it still doesn't work.
Finally, I even tried to delete the script and temporarily put it in the 🗑Recycle Bin (beta version). Even if I delete it to the Recycle Bin, the script is still working...
Therefore, I think it is not a script code problem (I encounter a very simple code that does not have any problems also have this problem), so this is completely a bug in the Tampermonkey container.
@derjanb I have sent the configuration of Tampermonkey and 100+ scripts to your 📧mail. You can reproduce the problem in 5 minutes.
Finally, the test content:
Why is the script of the page excluded, even after the script is deleted to the recycle bin, the script is still executed in the background?
Why the script code itself has no problem, but it will cause performance crash on some pages, why? Because I used
Violentmonkey
for the same test, there is no such performance problem and the problem that cannot be eliminated.