SteamWebIntegration icon indicating copy to clipboard operation
SteamWebIntegration copied to clipboard

Optimization

Open Eiion opened this issue 6 years ago • 33 comments

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.

Eiion avatar Apr 05 '19 05:04 Eiion

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

Revadike avatar Apr 05 '19 06:04 Revadike

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?

Eiion avatar Apr 05 '19 11:04 Eiion

it was a typo

Revadike avatar Apr 05 '19 11:04 Revadike

On what page are u experiencing lag?

Revadike avatar Apr 05 '19 11:04 Revadike

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.

Eiion avatar Apr 05 '19 12:04 Eiion

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 avatar Apr 05 '19 14:04 Revadike

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

Eiion avatar Apr 07 '19 14:04 Eiion

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.

Semenox avatar Apr 11 '19 08:04 Semenox

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 avatar Apr 11 '19 12:04 Revadike

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

Revadike avatar Apr 11 '19 12:04 Revadike

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...

Semenox avatar Apr 11 '19 21:04 Semenox

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.

Eiion avatar Apr 12 '19 06:04 Eiion

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

Semenox avatar Aug 24 '19 21:08 Semenox

Todo for optimization:

  • [x] Use css stylesheets, instead of style-attribute
  • [x] Better/optimized way of creating and adding nodes
  • [x] Anonymized functions
  • [x] Use promises to load data simultaneously
  • [x] Option for site blacklist
  • [x] 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

Revadike avatar Aug 25 '19 23:08 Revadike

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

Semenox avatar Aug 26 '19 04:08 Semenox

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.

Revadike avatar Aug 26 '19 11:08 Revadike

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 avatar Aug 26 '19 23:08 Semenox

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...

Semenox avatar Aug 29 '19 22:08 Semenox

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

Revadike avatar Aug 29 '19 22:08 Revadike

"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.

Semenox avatar Aug 30 '19 05:08 Semenox

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.

Eiion avatar Aug 30 '19 14:08 Eiion

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

Revadike avatar Aug 30 '19 15:08 Revadike

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

Eiion avatar Aug 30 '19 22:08 Eiion

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

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

Revadike avatar Aug 30 '19 22:08 Revadike

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 :)

Semenox avatar Aug 30 '19 23:08 Semenox

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 !

Eiion avatar Aug 31 '19 02:08 Eiion

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.

Revadike avatar Aug 31 '19 02:08 Revadike

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 avatar Mar 22 '21 17:03 Luckz

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

Luckz avatar May 28 '21 18:05 Luckz

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.

Revadike avatar May 28 '21 18:05 Revadike