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

Optimization #14

Open
Eiion opened this issue Apr 5, 2019 · 33 comments
Open

Optimization #14

Eiion opened this issue Apr 5, 2019 · 33 comments

Comments

@Eiion
Copy link

Eiion commented Apr 5, 2019

I'm sorry that I can't give you more detail on the issue than that. All I can tell you is that since Tampermonkey asked me to update the scripts - and SteamWebIntegration was the only one getting an update - page loading got terribly slowed down on Steamgifts.

Additionally I'm also using the ESGST extension to load in multiple pages at once. With SWI things always were slower, but still relatively comfortable to use. But since the update it actually is as fast as back in the late 90s, when you had to wait for minutes until everything is loaded and you can even scroll again.
I'm not exaggerating, it actually takes several minutes to be able to do anything again on the page. Severy times the browser tab even crashed.

So whatever you did with the update seemed to have massive effects on usability.

EDIT: Tampermonkey also shows "'jQuery' is not defined" in line 62 besides many other issues down the lines.

@Revadike
Copy link
Owner

Revadike commented Apr 5, 2019

Are you sure you are on the latest version - 1.8.1? I've improved the performance in that version.

@Eiion
Copy link
Author

Eiion commented Apr 5, 2019

The code says "@Version 1.8.1" and the Tympermonkey overview also says "Steam Web Integration | 1.8.1".
It was last updated 6 hours ago. Before that, sometime in the night/very early morning between wednesday and thursday/thursday.

Here's a screenshot:
Download

That's the latest version the updater was giving me. This is the updating URL: https://github.com/Revadike/SteamWebIntegration/raw/master/Steam%20Web%20Integration.user.js

The code of the script on github also says 1.8.1 - so your 8.0.1 was a typo?

@Revadike
Copy link
Owner

Revadike commented Apr 5, 2019

it was a typo

@Revadike
Copy link
Owner

Revadike commented Apr 5, 2019

On what page are u experiencing lag?

@Eiion Eiion closed this as completed Apr 5, 2019
@Eiion Eiion reopened this Apr 5, 2019
@Eiion
Copy link
Author

Eiion commented Apr 5, 2019

The pages that I did use it on (before I found out that SWI was what caused the lag and switched it off) were the "Groups" giveaways page as well as a single group's giveaways page. It was still okayish with only one page loaded in but got unsuable pretty much right after with endless scrolling enabled and loading in up to 11 pages (though it actually never even made it to eleven pages).
Before this was never an issue. Even with several more than just 11 pages this was never an issue until the update.

@Revadike
Copy link
Owner

Revadike commented Apr 5, 2019

Well, before it only executed once and if new stuff gets loaded in the same page it wouldn't be detected.
Now every time new links are loaded it executes the function again. So, it would make sense it's more demanding. I can likely be optimized further. Though, I'll have to look into this. Also any help is appreciated!

@Revadike Revadike changed the title Since Last 2 Updates SWI causes MASSIVE lagging in page loading on Steamgifts Optimization Apr 5, 2019
@Revadike Revadike self-assigned this Apr 5, 2019
@Eiion
Copy link
Author

Eiion commented Apr 7, 2019

Not sure how I could help. I can test new versions, but I guess that's about it as I'm not a programmer.

@Semenox
Copy link

Semenox commented Apr 11, 2019

HI, here is video with function this scrip now https://youtu.be/Gwd8LuWUi10

Reading its now very slowly. Before maybe two weeks ago was all ok, and all scipt info on this site was loaded instant. Hope this help you find problem.

@Revadike
Copy link
Owner

HI, here is video with function this scrip now https://youtu.be/Gwd8LuWUi10

Reading its now very slowly. Before maybe two weeks ago was all ok, and all scipt info on this site was loaded instant. Hope this help you find problem.

Well, I'd argue that's fine. Otherwise it may slow down the entire page (like it being freezed).

@Revadike
Copy link
Owner

Actually I just tested myself and it goes much faster for me. But maybe that's because I have a better PC or something.

@Semenox
Copy link

Semenox commented Apr 11, 2019

Actually I just tested myself and it goes much faster for me. But maybe that's because I have a better PC or something.

I thing its not about PC. I use this script maybe year and all was ok and instat. If i visited this site, all info was loaded instantly. Now, its this script unusable on web like this with 1000+ games. This start maybe 2-3 update before :( Can you give me link to old version, two months or later? I can test it.

OK, i tried 1.7.7 . This old version dont show some info, bul load on site was instant. I try others version...

@Eiion
Copy link
Author

Eiion commented Apr 12, 2019

I have to agree with Semenox - before it was basically instant, now it's not. This has nothing to do with our PCs, as at least mine didn't change in the meantime. The only thing that did change though was the script.
I had the script running all the time so well, that I didn't even think about maybe disabling it. Since the update though it's always off because of what I've described in the original post.

@Semenox
Copy link

Semenox commented Aug 24, 2019

After last update its this script slower then last... On barter im must disable it on long games lists.. script freeze Firefox :(

@Revadike
Copy link
Owner

Revadike commented Aug 25, 2019

Todo for optimization:

  • Use css stylesheets, instead of style-attribute
  • Better/optimized way of creating and adding nodes
  • Anonymized functions
  • Use promises to load data simultaneously
  • Option for site blacklist
  • Option to disable specific css selectors
  • Lazyload the icons
  • Better/optimized mutation observing
  • Better/optimized css selectors
  • Pass less information between functions
  • Only check mutated nodes

@Semenox
Copy link

Semenox commented Aug 26, 2019

Can you try release old version +- from January ? In this time was all ok. Now oldest version dont work.

@Revadike
Copy link
Owner

Can you try release old version +- from January ? In this time was all ok. Now oldest version dont work.

I don't support old versions. If you like something from an old version to return to the new version, let me know.

@Semenox
Copy link

Semenox commented Aug 26, 2019

I dont know where are changes in core :) Btw i want try Grease or Violent monkey editors if there scipts run better, but in both script dont work :(

@Semenox
Copy link

Semenox commented Aug 29, 2019

Next "slow" tip..
https://www.ventusky.com/?p=46.1;26.8;4&l=radar&t=20190829/2200 here if its script active, then move on map its super laggy and unusable. If i turn off SWI all its ok and quick. Seem like script tracks something on every pages or soo...

@Revadike
Copy link
Owner

In order to support dynamic web pages, it tacks all newly loaded content. Not sure what tip you're offering.

@Semenox
Copy link

Semenox commented Aug 30, 2019

"tip" i can try find some things what you can help find problem. If its script active, laggy on map what i post.(zooming or move on map its laggy, if its script off its all ok) I dont know what you change in scrip in last half year but something on script create this problems. I write you x time, early was all ok ans script works instantly, fast and without lags. I tried reinstal complete FF, change script manager, turn off addons and milon other things, but nothing dont have efect.

@Eiion
Copy link
Author

Eiion commented Aug 30, 2019

It seems like semenox is not a native English speaker so obviously he's not offering actual tips @Revadike but "tips" obviously is just his slightly off wording to say that "Here's something, what about that issue?".
He's apparently just chiming in saying the same as I did, which is that you have changed the code back then and that ever since that update SWI causes very big lag issues as already described by me above in the original post.

@Revadike
Copy link
Owner

Revadike commented Aug 30, 2019

Try https://github.com/Revadike/SteamWebIntegration/releases/tag/V1.9.4 and choose to disable dynamic content. @Eiion @Semenox

@Eiion
Copy link
Author

Eiion commented Aug 30, 2019

What's the differences between disabled, ping and observe? (I couldn't try it, yet.)

@Revadike
Copy link
Owner

What's the differences between disabled, ping and observe? (I couldn't try it, yet.)

More details here: https://revadike.ga/swi/settings/

@Semenox
Copy link

Semenox commented Aug 30, 2019

Tried - Disabled (only check once) and............. looks like this fix my problem 🥇 :) I test it more :)

And as Eiion write my english is too bad and i want help but have problem say it right :) I love this script and all i mean in good - not offense or soo :)

Yeaaaah :) On all sites its it now quick and smooth :D Thanks :)

@Eiion
Copy link
Author

Eiion commented Aug 31, 2019

I tried disabled and that worked fine - unless there's a page with endless loading (i.e. further pages are being displayed when scrolling down). So instead I tried the "Check every 1,5 second" (there's an "s" missing) option and that works well. Though I wouldn't mind if it would check only every 2 or even 3 seconds. So an option to change that time period would be great (until then I've changed line 498 - setInterval(doSWI, 1500); - manually to 3000).

Talking of options, with the update from the original post (I think that was it) the background color for the SWI icons changed as well and unfortunately the settings page has no option to change that to everyone's personal likings. So having no option I'm changing that (line 585 - background: rgba(0, 0, 0, 0.7); - to alpha=0) manually as well and it would be great if you could add that to the settings page along with the options for the other colors.

Thanks for the fix @Revadike !

@Revadike
Copy link
Owner

I tried disabled and that worked fine - unless there's a page with endless loading (i.e. further pages are being displayed when scrolling down). So instead I tried the "Check every 1,5 second" (there's an "s" missing) option and that works well. Though I wouldn't mind if it would check only ever 2 or even 3 seconds. So an option to change that time period would be great (until then I've changed line 498 - setInterval(doSWI, 1500); - manually to 3000).

Talking of options, with the update from the original post (I think that was it) the background color for the SWI icons changed as well and unfortunately the settings page has no option to change that to everyone's personal likings. So having no option I'm changing that (line 585 - background: rgba(0, 0, 0, 0.7); - to alpha=0) manually as well and it would be great if you could add that to the settings page along with the options for the other colors.

Thanks for the fix @Revadike !

If you'd like to make suggestions outside performance, please create a separate issue for it.

@Luckz
Copy link
Contributor

Luckz commented Mar 22, 2021

I have SWI set to "only check once" for performance reasons anyway, and re-run manually on demand, like when ESGST loaded several pages of giveaways. It's not that much trouble to do those two mouse clicks when I need it.

@Luckz
Copy link
Contributor

Luckz commented May 28, 2021

There's some performance chat in #54 , and performance should in general be better as of https://github.com/Revadike/SteamWebIntegration/releases/tag/V1.11.5

@Revadike
Copy link
Owner

There is one thing I've been thinking about. Should we refresh data only after detection of first steam link/image? This would significantly increase the delay between detection and showing icon.
Also, does it even matter? There is a cache system in place. I think there was another reason, but I forgot.

@Eiion
Copy link
Author

Eiion commented May 29, 2021

The thing is, back then, before the update that introduced the issue, the script ran perfectly fine without any noticeable lag even with pages where content gets added on (like with endless scrolling on SG via ESGST). There was no issue at all with that. Then, after the changes in SWI huge lag up to the point of making the script practically unusable to the point where it had to be turned off occurred.
So, from how I understand what you are saying, removing the refresh feature at all would break the script for long continuously loading pages and only show info for the first page. Which would be a very big step back... again, as far as I understand what you're saying.
But, if I got that right... yes, it matters. As the update introducing the issues in the original post showed cache apparently didn't help.

@Revadike
Copy link
Owner

Can you tell me which versions you're comparing?

@Luckz
Copy link
Contributor

Luckz commented May 29, 2021

@Eiion I meant to say that using the userscript manager menu (in Chrome/Tampermonkey also available via right-click into the page now), you can manually re-run SWI after you let endless scrolling load all the items you want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants