-
Notifications
You must be signed in to change notification settings - Fork 0
Website code improvements #14
Comments
Thanks for the tips. Some comments:
|
|
I'm not sure what you mean by "even if caching is disabled." If a client does disable caching for some morbid reason, I don't really think it's necessary to optimize for them. I also can't find any spec that discusses this. Prefetching fonts is kinda reasonable, but I've never seen it done in practise since you don't know which font file (eot, ttf, etc) the client will need until it parses the CSS. I don't see why browsers would perform extra DNS lookups if the TTL is set to a reasonable value. I have not known this to ever occur – in fact most of the time their aggressive caching is more annoying than anything else. In any case, our DNS should respond extremely quickly worldwide. I struggle to find any well-known sites that use prefetching, and it honestly seems like a pretty niche tool that is only applicable to a few edge cases. If I have time I'll find a Windows VM to fix the Windows 8 issues. |
I've done a bit of research and prefetching does in fact improve performance because it uses the cache more efficiently. By the way, that article is a bit outdated, so please use prerender instead of prefetching whole pages if you're going to do that. I'm not sure, but you should be able to prefetch your fonts using Feature Detection and then prefetching the compatible fonts for the web browser in use. My mistake, you're right that browsers don't perform extra dns lookups. Your DNS responds really fast, but unfortunately some people have really slow ping times of over 500ms. Bing US pre-renders, prefetches and dns-prefetches websites in its search results. Try searching for Wikipedia on http://bing.com/account/action?scope=web&setmkt=en-US&setplang=en-us&setlang=en-us and wait a few seconds before clicking the wikipedia search result. It should show up instantly. Google search also use pre-fetching and pre-render, but only for search results. You can get VMs and BrowserStack at http://modern.ie/ |
I think you're getting the wrong idea about what prefetching is for. Rather than using it to load resources already on the page, it should be used to load resources on pages the user is probably going to navigate to later. This is why Bing/Google prefetch search results, but not their stylesheets and JS etc. The same applies to DNS prefetching – if you expect that users will normally navigate to a certain page after the current one, you can prefetch the DNS to reduce the latency for that navigation. |
Ah, I must've misunderstood what prefetching is for. Thanks for explaining it clearly, sorry about that. Could you please add flip-ahead and OS intergration? |
The https://mods.io/ website is already very well made (no really, it's miles better than sites like PlanetMinecraft which are using really old code), but it could still do with some improvements to ensure maximum performance and better compatibility with future and past browsers. Most of these code changes are minor, but it seems to make a big positive impact.
Use flip ahead so that modern browsers can pre-render/preload the next page
Using this will improve performance on most modern browsers, not just IE.
http://msdn.microsoft.com/en-us/library/ie/jj883726%28v=vs.85%29.aspx
Note: If you find it difficult to implement flip ahead, just use pre-render for the next page instead like so:
then on page 2 you pre-render page 3, etc...
Add OS intergration
Yes, I know this won't make the site quicker, but it allows you to make your site icon look better for stuff such as your site being pinned to the start screen or task bar with just two lines of code. If you really want, you could have your own custom jumplists for mods.io which take you to the dashboard, homepage, etc...
http://www.buildmypinnedsite.com/
Prevent IE compatibility mode
With IE compatibility mode sometimes turning on, on IE10 and lower, your site sometimes ends up looking bad and going slow. This is IE's fault, but you can fix it by configuring nginx to tell IE (and only IE) to not use compatibility mode.
Since you're using HTML5, preventing compatibility mode will actually fix your website with old IE, rather than breaking it.
The text was updated successfully, but these errors were encountered: