Lurker News

Comments (337) 70 threads

WestCoastJustin9 replies#
Live demo on my website @ https://sysadmincasts.com/

Temporary added it in-line for testing. I was already in the sub 100ms level but this just puts it over the top! Also updated all admin add/edit/delete/toggle/logout links with "data-no-instant". Pretty easy. Open developer preview and watch the network tab. Pretty neat to watch it prefetch! Thanks for creating this!
ps. Working on adding the license comment. I strip comments at the template parse level (working on that now).
pps. I was using https://developers.google.com/speed/pagespeed/insights/ to debug page speed before. Then working down the list of its suggestions. Scoring 98/100 on mobile and 100/100 on desktop. I ended up inlining some css, most images are converted to base64 and inlined (no extra http calls), heavy cache of db results on the backend, wrote the CMS in Go, using a CDN (with content cache), all to get to sub 100ms page loads. Pretty hilarious when you think about it but it works pretty well.

m0zg#
This is what the OP should have posted. Very impressive. Will use in my work.
totony2 replies#
nothing on my network tab in ff 65.0
SCdF1 reply#
ditto. It works on Chrome though (sigh)
sneak1 reply#
Why the sigh? It says right on the site that this gracefully degrades on browsers that don’t support it. Why is it a problem making a site faster in a browser designed for speed, if it does not degrade the experience at all in all other browsers?

Continue this thread — 1 reply

calibas#
Not working for me either, Chrome works great though.
harrisonjackson2 replies#
Very impressive! Wonder if it'd be worth rerouting some of the paginated URLs like the episodes `?page=4` to `/page-4` or something like that. :shrug: - either way, looks like you had some fun optimizing it!
WestCoastJustin1 reply#
Good idea. I'll check that out! Thanks.
dieulot1 reply#
I just released version 1.1.0 which allows whitelisting specific links with query strings like those. https://instant.page/blacklist

Continue this thread — 1 reply

merkaloid1 reply#
/page/4 would probably be more prudent
harrisonjackson#
I don't like this as much since a savvy user might then try to navigate to /pages/ - which has what on it?
SquareWheel1 reply#
Embedding base64 images isn't really more efficient on HTTP/2 servers. Base64 adds overhead, and multiplexing mitigates the cost of additional network requests.
ponyfleisch1 reply#
But unless you use server push, it still is an additional roundtrip.
dalore#
Yes but since it's multiplexed into the same tcp stream it doesn't suffer from slow start and so the tcp window is already large so it's not as bad as it would be on http1.
ehsankia#
I like that there's an extra optimization where it cancels the preload if your cursor leaves and the prefetch hasn't finished it. Would help on really slow networks and pages that timeout.
fwip3 replies#
If I mouse-over the same link 10 times, it looks in my network tab like it downloads the link 10 times.

I'd expect this preload script to remember the pages it's already fetched and not duplicate work unnecessarily. :/

threatofrain1 reply#
But how do you know it's still fresh?
Piskvorrr#
HTTP has multiple cache control headers. It's a fairly complex topic, but TL;DR: do the config and it works in any browser since ~2000 (yes, even IE6).
aruggirello1 reply#
Perhaps the author could add a script parameter, or support an optional 'preload-cache-for' attribute, so you'd write

If you really care about speed anyway, you should already have setup your site to max out caching opportunities (Etag, Last-modified, and replying "not-modified" to "if-modified-since" queries) - I'd suggest the author should ensure the script does support caching to the broadest extent possible - hitting your site whenever appropriate.

ajsharp1 reply#
Set your http cache headers correctly to instruct the client to save and re-use pages it downloads.
WestCoastJustin#
Yeah, this is likely something I need to look into. Since the site changes quite a bit for, non-logged vs logged, I'm not really doing much html caching right now. I'll check that out though. Even if I added something like 30 second cache TTL that might work. I'd have to see if that is even possible and test though. Maybe force an update on login? I'm not a html cache pro so I'd need to see what the options are and then do some testing. For now, it was just fast enough / not worth the time, to do anything other than a fresh page for each request. But, this is a good suggestion. Thanks.

ps. I do tons of caching for any images and videos though. I know those things never change so have weeks of caching enabled.

ksec#
I wonder if breaking the page into two parts as above and below the fold, Above would even have base64 images and all inlined, below would get analytics script loaded.
WestCoastJustin#
UPDATE - Feb 11. I removed the include for now. I was seeing a weird caching issue when people login/logout where the navbar would not update correctly (for the first few requests after). I'm still digging into this. I likely need to invalidate the browser cache some how. Doing some research to see what the options are.
bradknowles1 reply#
Have you signed up for a page speed monitoring service, like https://speedmonitor.io/ ?

I'd be very curious to know what your performance looks like over time, especially as it relates to various improvements that you try out.

Continue this thread — 1 reply

xpose20002 replies#
I've been testing it for the past 30 minutes or so and found that it doesn't cause the same problems that InstantClick did. (Which was javascript errors that would randomly occur.) I'll limit it to a small subset of users to see if any errors are reported but there is a good chance this could go live for all logged in users. Maybe even all website visitors if all goes well.

Seems to have no impact on any javascript, including ads. Pages do load faster, and I can see the prefetch working.
Just make sure you apply the data-no-instant tag to your logout link, otherwise it'll logout on mouseover.

hn_throwaway_991 reply#
> Just make sure you apply the data-no-instant tag to your logout link, otherwise it'll logout on mouseover.

Logout links should never be GETs in the first place - they change states and should be POSTs.

slim3 replies#
POSTs are not Links. And Logout service is indempotent even if you can consider it changes the state of the system
glacials21 replies#
Idempotency is not the issue, the issue is that a user might hover over the logout link, not click it, then move on to the rest of the site and find they are logged out for no reason.

Continue this thread — 21 replies

Gaelan#
Ok, so make it a form/button styled to look like a link.

Continue this thread — 3 replies

ezequiel-garzon1 reply#
Thanks, how did you find out about data-no-instant tag?
js4ever4 replies#
Each time you hover over a link it's doing a GET request bypassing the cache (cache-control: max-age), even if you hove the same multiple times. Also this will make all your analytics false... Except that indeed this can improve greatly the user sensation of speed
mariopt3 replies#
The analytics should only be triggered is the page is rendered, assuming it's done client side. I believe Google does this for first top 3 results if I'm not mistaken.
michaelbuckbee#
This helped me quite a bit, my mental model of how this worked was off. Prefetching only downloads the resources but does not actually execute any js code. So sites doing lots of tag managers or other js loading js likely wouldn't benefit, but standard GA, etc. should be fine.
hombre_fatal2 replies#
Good point.

What would be a good way to avoid prefetch requests in your analytics if you only derive analytics from server access logs?

8bitben1 reply#
Most browsers pass a "purpose:prefetch" or similar HTTP header in the prefetch request that you can use to differentiate

Continue this thread — 1 reply

Drakim2 replies#
You could obviously do it with JavaScript by pinging the server to tell him that log entry X is to be promoted to a true "hit".

For a non-JS solution, I guess an tiny iframe at the bottom of the html page that accesses a special server page with an unique stamp that causes the same "hit". the iframe loading would mean that the rest of the page is mostly loaded before it was closed.

Continue this thread — 2 replies

Continue this thread — 1 more reply

Continue this thread — 3 more replies

cjblomqvist14 replies#
It seems everybody is missing this but this could actually slow down your experience, and I'd actually guess it will in some scenarios (ie. not only a theoretical situation).

Considering a user hovering over a bunch of links and then clicking the last one, and doing this in a second. Let's assume your site takes 3 sec to load (full round-trip) and you're server is only handling one request at a time (I'm not sure how often this is the case, but I wouldn't be surprised if that's the case within sessions for a significant amount of cases). Then the link the user clicked would actually be loaded last, after all the others - this probably drastically increase loading time.
The weak spot in this reasoning is the assumption that you're server won't handle these requests in parallel. Unfortunately I'm not experienced enough to know whether that happens or not, but if so, you should probably be careful and not think that the additional server load is the only downside (which part like is a negligible downside).

Continue this thread — 14 replies

Load more comments