5 ms·
First off, nice work. I've noticed that St4k is loading each thread using ajax, where-as stackoverflow actually opens a new 'page', reloading a lot of webreques
by cobookman 13y ago
First off, nice work.
I've noticed that St4k is loading each thread using ajax, where-as stackoverflow actually opens a new 'page', reloading a lot of webrequests. Disclaimer I've got browser cache disabled.
E.g on a thread click:
St4k:
GET https://api.stackexchange.com/2.2/questions/21840919 https://api.stackexchange.com/2.2/questions/21840919 [HTTP/1.1 200 OK 212ms]
18:02:16.802
GET https://www.gravatar.com/avatar/dca03295d2e81708823c5bd62e752121 https://www.gravatar.com/avatar/dca03295d2e81708823c5bd62e75... [HTTP/1.1 200 OK 146ms]
18:02:16.803
stackoverflow.com (a lot of web requests):
GET http://stackoverflow.com/questions/21841027/override-volume-button-in-background-service http://stackoverflow.com/questions/21841027/override-volume-... [HTTP/1.1 200 OK 120ms]
18:02:54.791
GET http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min... [HTTP/1.1 200 OK 62ms]
18:02:54.792
GET http://cdn.sstatic.net/Js/stub.en.js http://cdn.sstatic.net/Js/stub.en.js [HTTP/1.1 200 OK 58ms]
18:02:54.792
GET http://cdn.sstatic.net/stackoverflow/all.css http://cdn.sstatic.net/stackoverflow/all.css [HTTP/1.1 200 OK 73ms]
18:02:54.792
GET https://www.gravatar.com/avatar/2a4cbc9da2ce334d7a5c8f483c9216e1 https://www.gravatar.com/avatar/2a4cbc9da2ce334d7a5c8f483c92... [HTTP/1.1 200 OK 90ms]
18:02:55.683
GET http://i.stack.imgur.com/tKsDb.png http://i.stack.imgur.com/tKsDb.png [HTTP/1.1 200 OK 20ms]
18:02:55.683
GET http://static.adzerk.net/ados.js http://static.adzerk.net/ados.js [HTTP/1.1 200 OK 33ms]
18:02:55.684
GET http://www.google-analytics.com/analytics.js http://www.google-analytics.com/analytics.js [HTTP/1.1 200 OK 18ms]
18:02:55.684
GET http://edge.quantserve.com/quant.js http://edge.quantserve.com/quant.js
....and more....
- deleted 13y ago[deleted]
- oneeyedpigeon 13y agoAlmost all that really tells us is that you have browser cache disabled (resources such as jquery wouldn't be re-requested on StackOverflow is you didn't). As a matter of interest, why are you disabling browser cache? Doesn't that waste a needless amount of bandwidth? Is it for some kind of security reason?
- cobookman 13y agoI'm currently developing a lot of websites. Disabling browser cache ensures that every file is the most resent version (and not cached), as well as to better see dependency loading. Even with browser cache enabled, stack overflow loads a considerable number of resources compared to st4k. St4k loads 1 api call to get the S.O. data (JSON - ~1KiB), then loads any needed images. Stack overflow is loading the entire HTML document again (~15KiB), along with a lot of other web resources. Without going into their code, I've got no idea on what is lazy loading. But my point still stands on the speed of page navigation (not first time landing). St4k is faster as each change of page requires less KiBs of information to perform a page render, as well as less content to render: Compressed JSON, vs the entire HTML markup, and Rendering the Changes vs Re-Rendering the entire window/document.
- oneeyedpigeon 13y agoOh, yes - I certainly agree that St4k is a lot faster than Stack Overflow, but I'm not sure quite whether to attribute that to exactly what's happening on the server (remember that the real SO will have load several orders of magnitude greater), fewer 'requirements' (e.g. no analytics?), more efficient markup, or specifically loading markup via AJAX+JSON rather than the 'normal' web route. I'm surprised there's such (15/1) a difference between the HTML and JSON versions of the same data. Both add their own syntactic cruft, but I wouldn't expect the weight of the markup to be that much greater than the equivalent JSON, unless it's being implemented horribly inefficiently (e.g. very verbose class names, inline styling, DIVitis). I'm suspicious about that 15/1 figure. All in all, though, this is an interesting approach. Nothing radically new, but definitely good to see a solid proof of concept that we can all relate to. I particularly like the way this gets around any api throttling limits since the St4k server isn't doing the communication with SO, it's all happening client->server, much as if one were just browsing SO as normal. Is there a term for this? It's not quite a proxy, since it's not 'in the middle', but more 'off to the side, not interfering directly, merely offering helpful advice' :)
- oneeyedpigeon 13y agoOK, having looked at the SO source, it's evidently not very concise. Full of inline script, lots of 'data-' attributes, even - gasp - tables for layout. (I think I was dimly aware of that last point, but had chosen to pretend it wasn't the case. And, yes, I know that HN is no better in that regard) Still, FIFTEEN times weightier ...?