5 ms·
>> Just send less script. A lot less. The less script you're sending, the less likely it is that your script is doing something dumb to make things slow. This
by at-fates-hands 11y ago
>> Just send less script. A lot less. The less script you're sending, the less likely it is that your script is doing something dumb to make things slow.
This - a thousand times.
This is why I tend to shy away from CMS' like Wordpress and Drupal. The amount of JS they load is insane. Not only do they load JS directly in the <head>, but then load a bunch more at the bottom of the page.
The problem with these is you either download and configure an easy to use plugin every time you need some functionality (image gallery, contact form, meta tags for seo) which load their own scripts and css stylesheet, or you have to write your own and then integrate into whatever CMS you're using.
two good Wordpress examples:
http://worryfreelabs.com/ http://worryfreelabs.com/ - 6 scripts in the head, more than a dozen after the <body> tag. 113 requests and a staggering 14.7MB just on the home page.
http://www.thisisyourkingdom.co.uk/ http://www.thisisyourkingdom.co.uk/ - 9 scripts in head, 4 more in the body and close to a dozen style sheets that were loaded. 68 requests which took close to 9 seconds to load.
- fabian2k 11y agoAt least Drupal 8 is much better about this, by default it doesn't load any JS unless there is actually anything on the page that requires it. And scripts are added below the main content and not in head. Caching also got much better in Drupal 8 and is enabled by default, which makes a huge difference in speed. You always have to be careful with a CMS, it's very easy to load a lot of unnecessary stuff, but you can still build very fast and lean sites with Drupal with only a bit of knowledge.
- at-fates-hands 11y agoI've been thinking of going back to Drupal for some time now. Thanks for the heads up to take another look at it again.
- luxpir 11y agoI'll throw in my own 2 cents, in agreement. I have tried to use SPDY, Nginx 'microcaching', Drupal caching to make my own Drupal 7 project load as quickly as possible. I still need to make the font and bootstrap calls local (potentially dropping the fancy font for Georgia or Verdana, even Helvetica...) to really bring the load times down further. There are other settings to tweak still, but it's one example of Drupal not dragging its feet too much. It certainly let this 'dev' create a usable piece of software, at least. > https://www.linguaquote.com https://www.linguaquote.com PS - also looking forward to Let's Encrypt and http2 in Nginx.
- mikeytown2 11y agoCheckout the AdvAgg module [1] it does async font loading. It was used to speedup the frontend of drupal.org and the results are fairly remarkable [2]. Also if you looking for more ways to speed up drupal checkout my DIY Drupal 7 Performance [3] presentation. [1] https://www.drupal.org/project/advagg/ https://www.drupal.org/project/advagg/ [2] https://www.drupal.org/node/2493801 https://www.drupal.org/node/2493801 [3] https://docs.google.com/presentation/d/1Vaad5ToVU1lc7zWdN3qN3oFl4FBeeiHqteFyEeXurcs/edit https://docs.google.com/presentation/d/1Vaad5ToVU1lc7zWdN3qN...
- luxpir 11y agoThanks for that - have written up most of the performance work I've done and posted to HN[0] - I see from link [2] above that you retested drupal.org and found render times to have doubled since a recent change. It's so easy to undo all that hard work! [0] https://news.ycombinator.com/item?id=10418732 https://news.ycombinator.com/item?id=10418732
- mattmanser 11y agoErr, they're not good examples of bad javascript. The problem with worryfreelabs is all the images haven't been properly compressed. Yes, it's a terrible website, but not for the reasons you're insinuating. They've just put silly big images in. Also the reason for all the script tags is simply that they've not added JQuery UI properly. And the problem with thisisyourkingdom seems to be a singular plugin, the wordfence plugin, which on its own is taking 8 seconds in a request which seems to be some sort of broken logging (I couldn't be bothered to look at the code so it might be a deliberate hang to make sure the person is really a human, but it's a terrible way of doing it). Everything else is loading in sub-2 seconds. I'm all for ragging on Wordpress, as long as it's actually its fault ;)