dbjpanda / kb-elementor

Wordpress Elementor Plugin for creating wiki like knowledge based site | LMS | Category-Post tree | Series of Posts | TOC
10 stars 1 forks source link

heavy script tocbot.js #9

Closed wpsumo closed 5 years ago

wpsumo commented 5 years ago

Is the heaviest script on my site except for WordPress jquery.js and swiper.min.js. Javascript has a huge impact on performance, especially for mobile. Since installing the plugin on my staging environment I see a difference in performance.

I post this since it affects me as a user and will not use the plugin due to this performance downgrade. I think most things can be done in post-production and with css3 nowadays.

Since you care about performance in this plugin, consider looking into this.

/kb-elementor/assets/vendor/tocbot/tocbot.js?ver=5.2.2

dbjpanda commented 5 years ago

Please elaborate what you mean by Performance. Performance degradation in server side or in client side ? How did you check the performance ?

I think most things can be done in post-production and with css3 nowadays.

The Javascript used is client side script so it shouldn't have any effect on your server side. Also Tocbot is really very light in comparison with other toc js.

dbjpanda commented 5 years ago

Here is my test site's performance result. The site is hosted on a shared server. So respective of a bad server, I think 75 is good for mobile. Screen Shot 2019-06-28 at 4 22 32 PM Screen Shot 2019-06-28 at 4 22 13 PM

wpsumo commented 5 years ago

Client side. I run a stable AWS with layers of cache and is extremely stable.

The issue is that the script is heavy, I have much more complex plugin but none combined are nearby the file size and caused slower performance and score.

I don't know how it compared to other tocs but it surely slow down client-side and cause too much harm for me to use it with this downside on performance. I want to have a toc plugin but not when it has this downside. I think the calculations of grabbing headers id's etc can be in ost creation and nothing that needs to be running on-site load.

What is the script for?

I want to use to plugin understand me right but the script is heavy and affect a lot on mobile devices. Remember that users have other plugins as well and together it adds up scripts after scripts. Which cause worse score. but that's not the point is everyone should optimize their addon. And jquery and swiper are already heavy but the tocbot take to much on performance on mobile.

People still use 3g or slow 4g and do not have the latest phone with better computing power.

Why can't the plugin pre load all insert id etc and load 0 js files? The rest can be done with css3 css.

All I can say is that my staging sites took a hit in performance and script is the heavy part. As I disable your js script the sites run smooth once again.

Surely swiper.min.js from elementor is also a heavy part such as jquery.js from wp core. But those are a must to use swiper if a carousel/slide is in and lightbox.

Can you share your score before and after toc?

dbjpanda commented 5 years ago

How did you check the performance ?

You didn't reply this yet !!!

The issue is that the script is heavy

How do you conclude that the script is heavy ? If you are a developer there then tell me a better alternative. If not then don't conclude something on your own.

Why can't the plugin pre load all insert id etc and load 0 js files?

It can be done on server side also. I have a plan to make it configurable and let users select if they want server side things or client side. But every option have their own pros and cons. Probably client side is much preferable as I see most premium toc plugins do so. If you want to configure on server side just uncomment https://github.com/dbjpanda/kb-elementor/blob/33e3ff2f211d2ed73677e2b8a4ef898de8d4830a/modules/toc-headings/includes/functions.php#L32 and comment that function in js script. It is simple thing. Note: you might be using the code from master branch. I have cleaned all comments from that branch. So you need to copy paste that snippets.

Can you share your score before and after toc?

Sorry I can't help you much till you provide more details or screenshots. The problem is yours afterall. I see you never want to give any details of the issue. The way you expect thing doesn't work. Neither me nor anyone can help you out.

dbjpanda commented 5 years ago

Closing this issue due to lack of activity. Feel free to reopen it with more information.