Website page load speed

Development-related discussion, including bundled plugins
richbeales
Bear Rating Trainee
Bear Rating Trainee
Posts: 9
Joined: 15 Mar 2013, 18:04
Location: UK
Contact:

Website page load speed

Postby richbeales » 16 Mar 2013, 12:12

Hi,

The website version of tt-rss takes several seconds to load. Not a huge problem but looking at the network trace there's a couple of hundred requests for .js/.css/.png files (a lot of them from dojo.js/dijit and associated themes).

Would anyone with a bit more knowledge than me be able to bundle these up into a single file? Should improve load times quite a lot.

Thanks

Rich.

User avatar
fox
^ me reading your posts ^
Posts: 6318
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia
Contact:

Re: Website page load speed

Postby fox » 16 Mar 2013, 12:31

It is already partially done using dojo layer functionality, but feel free to improve it. There are some scripts to rebuild dojo in the tarball (lib/dojo-src).

richbeales
Bear Rating Trainee
Bear Rating Trainee
Posts: 9
Joined: 15 Mar 2013, 18:04
Location: UK
Contact:

Re: Website page load speed

Postby richbeales » 16 Mar 2013, 17:09

I'll give it a go - this looks useful (https://code.google.com/p/minify/wiki/BuilderApp)

Dojo 1.8 is out too, which is supposed to be smaller.

btux
Bear Rating Trainee
Bear Rating Trainee
Posts: 3
Joined: 18 Mar 2013, 00:49

Re: Website page load speed

Postby btux » 18 Mar 2013, 00:55

I'm running tinyrss on a Raspberry Pi - so I'm interested in having it faster. I've seen this dojo mess - so many files loaded after each other, my god. Garbish. Never use dojo. Websites cannot load fast like that.

Anyway, the biggest problem is NOT dojo. It's the compressing of JavaScript Code that happens in production mode with JSMin::minify. I already know it being really slow.
And it is indeed here. Page creation takes 16 seconds in the current git version. Without this compressing it is down to 1.5 seconds.

I'll write a version which will cache the compressed files and not compress it at each load.

User avatar
fox
^ me reading your posts ^
Posts: 6318
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia
Contact:

Re: Website page load speed

Postby fox » 18 Mar 2013, 09:15

>Never use dojo. Websites cannot load fast like that.

Yes frameworks sucks let's reinvent the wheel because, oh no, files are being requested.

>Anyway, the biggest problem is NOT dojo. It's the compressing of JavaScript Code that happens in production mode with JSMin::minify.

I'm sure the fact that you're running it on a glorified smartphone doesn't have anything to do with it.

>I'll write a version which will cache the compressed files and not compress it at each load.

That actually isn't a bad idea.

Edit: Now that I think about it, maybe it is. Adding complexity because raspberry pi is a no go for trunk.

User avatar
fox
^ me reading your posts ^
Posts: 6318
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia
Contact:

Re: Website page load speed

Postby fox » 18 Mar 2013, 11:01

After further consideration, this might improve startup performance after all, and the implementation is quite simple.

https://github.com/gothfox/Tiny-Tiny-RS ... 2fd26248d7

btux
Bear Rating Trainee
Bear Rating Trainee
Posts: 3
Joined: 18 Mar 2013, 00:49

Re: Website page load speed

Postby btux » 18 Mar 2013, 12:48

Oh, I'm not against JavaScript Frameworks, I'm fully in favour of them. But just not dojo. It's not just the file loading. I once was in a university seminar were three groups started using it (I was in one of it) - and it was funny because each group migrated away from it during the semester because of problems.

Anyway, the bad thing is that I planed a dynamic scriptloader for tinyrss. That's a php script that collects all required javascript scripts during loading and gives them out in one file (this big file is cached too). This greatly reduces the amount of http connections established between client and server increasing page load and decreasing load on both sides. The bad thing is, with this dynamic loading of javascript files as dojo does it, I don't see a clean way to do it.

But I really don't want to start a dispute because of this.

In the end, we did the same work. I've written a patch too. It's quite similar, but includes the plugin files into the caching too. And it is not using file times for deciding whether to use the cached version, but simply the tinyrss version number. (I don't expect JavaScript files to change between versions). Just one moment, need to find a way to place it here.

I looked through the rest of the code yesterday and did not find good points for optimization. If there is something you have not done yet (maybe because of the lack of time), I'm willing to look into.

btux
Bear Rating Trainee
Bear Rating Trainee
Posts: 3
Joined: 18 Mar 2013, 00:49

Re: Website page load speed

Postby btux » 18 Mar 2013, 13:02

Here is the patch.

JSMin::minify is not just slow on Raspberry Pis - I've seen it taking seconds on modern 6 core servers.
The Pi is slow but should be good enough. I just built a home server with it and tinyrss is a great part of it: https://btux1984.wordpress.com/2013/03/ ... pberry-pi/

With this patch, tinyrss is running fast enough. Still a second server work executing php (and some more time building up http connections for many JavaScript files to check whether the cached version is good enough). It's okay. But I'm still interesting in speeding it up.

Nonetheless tinyrss is great!
Attachments
cachepatch.patch
Patch for caching compressed js files
(10.39 KiB) Downloaded 183 times

jchristi
Bear Rating Trainee
Bear Rating Trainee
Posts: 17
Joined: 03 Apr 2013, 21:18

Re: Website page load speed

Postby jchristi » 03 Apr 2013, 22:00

I've developed with Dojo before and I guarantee you that slow apps built with Dojo are not a fault of the framework, but a fault of the developer (sadly, its very common with respect to Dojo). However, it is possible and not that hard to get blazing fast performance with Dojo. First, rather than using a third party compressor, Dojo has its own method for combining, minifying, and compressing: http://dojotoolkit.org/reference-guide/1.8/build/ (Note the system has undergone drastic changes between versions). Secondly, use of asynchronous module loading has become standard practice now so there is much performance to be gained from implementing that. I haven't gone through ttrss source code in depth yet so I can't speak to what has or hasn't been implemented but I'm pretty sure there is some low-hanging fruit for increasing page load speeds. If you are interested in helping out with this, I'll be on the #ttrss IRC channel on freenode.

jchristi
Bear Rating Trainee
Bear Rating Trainee
Posts: 17
Joined: 03 Apr 2013, 21:18

Re: Website page load speed

Postby jchristi » 04 Apr 2013, 04:07

Glancing at the dojo code it looks like there already is a ttrss build profile, so thats already been implemented. On page load, there are not that many js files downloaded but there are several ajax calls for additional js files. If any of those are dojo files, then including them in the ttrss layer would reduce the number of requests. Also I noticed the css files for each dijit gets pulled individually. If I remember correctly, there should be an option to inline css when compressing dijits. This also would help reduce the number of requests.

User avatar
fox
^ me reading your posts ^
Posts: 6318
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia
Contact:

Re: Website page load speed

Postby fox » 04 Apr 2013, 08:55

The build script is in lib/dojo-src: https://github.com/gothfox/Tiny-Tiny-RS ... b/dojo-src

>If I remember correctly, there should be an option to inline css when compressing dijits.

It would be great to add this.

jchristi
Bear Rating Trainee
Bear Rating Trainee
Posts: 17
Joined: 03 Apr 2013, 21:18

Re: Website page load speed

Postby jchristi » 04 Apr 2013, 18:12

fox wrote:The build script is in lib/dojo-src: https://github.com/gothfox/Tiny-Tiny-RS ... b/dojo-src

>If I remember correctly, there should be an option to inline css when compressing dijits.

It would be great to add this.


I should be able to do this pretty easily. What is your process for building the ttrss layer? I see rebuild-dojo.sh in lib/dojo-src but I don't see a "release" directory with the dojo src code anywhere in /lib. I assume this is because you do not want to include the release code in the repository. One suggestion I have is creating a submodule in the github repo such that we can include the dojo release directory but only by referencing the actual dojo github project. Here is an example of that in action: https://github.com/kitsonk/dojo-node-bo ... master/src. Take a look at the .gitmodules file for how to accomplish this.

User avatar
fox
^ me reading your posts ^
Posts: 6318
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia
Contact:

Re: Website page load speed

Postby fox » 04 Apr 2013, 18:17

This sounds too complicated. Like I said in the PM, unpack dojo source tarball to lib/dojo-src.

Running rebuild script would copy compressed stuff back to lib/dojo and lib/dijit, that's pretty much all there is to it. You can modify build profile and build options using lib/dojo-src/ files.

ArchCarrier
Bear Rating Trainee
Bear Rating Trainee
Posts: 16
Joined: 04 Apr 2013, 20:35

Re: Website page load speed

Postby ArchCarrier » 04 Apr 2013, 21:02

I've also noticed the slow loading of pages and the large number of requests for Javascript, CSS and image files.

But on my install there's another issue, which is that it takes very long for backend.php to load - sometimes 5 to 7 seconds. Also, that file is requested 4 or 5 times, so that the whole page usually takes around 20 to 30 seconds to load. Is this a bug, or some setting that I might change?

(And not that it really matters, but why is backend.php loaded on the front end of the application?)

jchristi
Bear Rating Trainee
Bear Rating Trainee
Posts: 17
Joined: 03 Apr 2013, 21:18

Re: Website page load speed

Postby jchristi » 04 Apr 2013, 21:52

So the inlining of Dijit css I thought existed was actually inlining of Dijit template HTML, which is already done by default. There is an additional option for optimizing css, which I've added but the performance gain is going to be negligible. However, I think there is a decent gain to be had by creating an additional build layer for dojo and dijit.


Return to “Development”

Who is online

Users browsing this forum: No registered users and 4 guests