Live data from Hacker News

Ask HN: Why and how is Hacker News so fast?

news.ycombinator.com

81–90 of 110 posts

Re: Ask HN: Why and how is Hacker News so fast?

#81
post #23

Earlier quoted context omitted.

So every time a new comment is posted, is the CloudFlare cache invalidated and replaced with a new version of the comments page?

Not sure, but cloudfare supposedly speeds up content delivery even for dynamic content where you need a new db hit each time. The idea is that it leaves open a persistent connection with the webserver, which means A) less work creating and destroying connections B) each new connection isn't starting off as throttled.

They have tech to do even better. See here https://www.cloudflare.com/railgun

That is how you can make it faster even when somebody is logged in and you are delivering a somewhat personalized experience.

Re: Ask HN: Why and how is Hacker News so fast?

#82
post #59

Earlier quoted context omitted.

I have been puzzled by this being said about dlang forever and today about HN. These sites are certainly not noticeably slow, but I don't notice anything remarkably fast about them either. Am I not visiting enough of the slow sites ? My working hypothesis is that I don't have a good understanding of web-development to appreciate the nuances. Much akin to me listening to Indian classical music, Jazz: I would often enc…

With an empty cache, for me, hacker news loads in ~700ms. Under the same conditions, the dlang site loads in ~200ms. That's half a second faster, which is definitely noticeable when clicking around.

Thanks for the numbers. A difference of 500ms would definitely be noticeable, especially if its in ones daily workflow

Re: Ask HN: Why and how is Hacker News so fast?

#83
post #28

Earlier quoted context omitted.

This one is crazy. How are they so fast?

No, forum.dlang.org is not crazy-fast. Other sites are crazy-slow. Write compact and easy-to-render HTML, it's no rocket science. Write some trivial CSS, you don't need Bootstrap. Make something dead-simple and call it flat design . If you have more than one stylesheet, concatenate them into one. Consider minifying. You don't need a 200 kB JS framework in order to fade in some hover menu. If you do need more than one…

What you're determining to be "needed" wrt design is very draconian and anti-progress. The web was ugly in 95 and appealed to few... progress in all areas -- especially design -- has made it what it is today.

Re: Ask HN: Why and how is Hacker News so fast?

#84

Earlier quoted context omitted.

No, forum.dlang.org is not crazy-fast. Other sites are crazy-slow. Write compact and easy-to-render HTML, it's no rocket science. Write some trivial CSS, you don't need Bootstrap. Make something dead-simple and call it flat design . If you have more than one stylesheet, concatenate them into one. Consider minifying. You don't need a 200 kB JS framework in order to fade in some hover menu. If you do need more than one…

> No, forum.dlang.org is not crazy-fast. Other sites are crazy-slow. You're ignoring that this site does use jQuery and webfonts and loads all of those pretty avatars separately. 22 requests, at my count. For the reasons you list - i.e. words to the effect of "don't use all of this stuff" - I think that it is impressively fast, and their achievement shouldn't be hand-waved away quite so readily.

I'm not ignoring anything, I'm describing the philosophy behind sites like these: It seems that perfection is attained not when there is nothing more to add, but when there is nothing more to remove. [1]

Many seem to believe that there is some secret sauce involved in making web pages load fast. There isn't. Server-side caching is no rocket science. The key is to keep everything so simple that you have the overview over every delivered byte at all times.

Take a look at the HTML of forum.dlang.org. It's so simple, if it wasn't minified, I could immediately start working on this site. When someone asks me to work on some existing wiki or blog template, I usually spend an hour removing unused code first and I still struggle to find my way around the codebase. At that point, maintaining efficiency becomes impossible.

When you have a simple codebase, you may add a font, avatars, and jQuery. The trick is to think about whether you need it, not throw it in "just in case." Specifically, some tiny avatars won't hurt overall performance as long as the page doesn't need to be redrawn. Therefore, always specify width and height attributes for your img elements in HTML or CSS.

[1] https://en.wikiquote.org/wiki/Antoine_de_Saint_Exup%C3%A9ry#...

Re: Ask HN: Why and how is Hacker News so fast?

#85

Earlier quoted context omitted.

No, forum.dlang.org is not crazy-fast. Other sites are crazy-slow. Write compact and easy-to-render HTML, it's no rocket science. Write some trivial CSS, you don't need Bootstrap. Make something dead-simple and call it flat design . If you have more than one stylesheet, concatenate them into one. Consider minifying. You don't need a 200 kB JS framework in order to fade in some hover menu. If you do need more than one…

What you're determining to be "needed" wrt design is very draconian and anti-progress. The web was ugly in 95 and appealed to few... progress in all areas -- especially design -- has made it what it is today.

I find that the prevalent user-friendly, minimalist design philosophy is very much compatible with performance principles like those that I have outlined.

Performance is not the opposite of UX, it is an important part of it.

Re: Ask HN: Why and how is Hacker News so fast?

#86

Without looking I can tell you it's two reasons: 1) It's text based and, therefore, can keep its total response small. 2) The page is cached on the backend so database lookups are kept infrequent and small. Those two reasons alone make it faster than, say, 80% of most web sites.

> Without looking

You risk being wrong this way. Your #1 is OK, but #2 is false: there's no database (in the sense of RDBMS or NoSQL) behind HN. It's just plain files on disk. Which, of course, makes fetching data blazingly fast, thanks to how filesystems are already handled and cached by the OS.

Anyway, I long suspected that "gzip and cache the hell out of your site" is not the best way to go about optimizing websites. From my experience websites come in two flavours: tiny with no need for optimization at all and huge, where you need to optimize everything and you know it's not going to be enough unless you're willing to rewrite some code in C.

Re: Ask HN: Why and how is Hacker News so fast?

#87
post #18

If you want to see an even faster "forum", see http://forum.dlang.org/

To some of you who are testing with your browser: Observing load times in your browser is fine for just fun but latency is irrelevant when evaluating the speed we're talking about here. A loading time benchmark of server-side code should naturally be calculated server-side, a server-side measurement of how long it took to execute the backend code. Nobody can accurately benchmark D over the net using their browser. If D is also being used to code the web server, then a browser should be used to benchmark the code but not across the net unless you can somehow subtract your latency. If not, it should be done locally or over a LAN where latency is extremely consistent but probably locally. I always benchmark my sites in this way.

As for D being quite fast, the consensus is that yes, it is. From what I gather, you'd be hard-pressed to beat or match it using any other language not counting perhaps assembly. It also seems to have a relatively low memory footprint comparable to that of C and C++.

IMO, more people need to be using D. It seems to outperform every other language in every speed benchmark I've seen, is packed with modern features, and doesn't have a steep learning curve. I'm not someone who has a bias toward D either. I've only recently become interested in it and I come from a background of C, C++, and C# (As well as many scripting languages).

Try D, I am.

Re: Ask HN: Why and how is Hacker News so fast?

#89
post #87
post #18

If you want to see an even faster "forum", see http://forum.dlang.org/

To some of you who are testing with your browser: Observing load times in your browser is fine for just fun but latency is irrelevant when evaluating the speed we're talking about here. A loading time benchmark of server-side code should naturally be calculated server-side, a server-side measurement of how long it took to execute the backend code. Nobody can accurately benchmark D over the net using their browser. If…

> It seems to outperform every other language in every speed benchmark I've seen

> It seems to outperform every other language in every speed benchmark I've seen

I like D. A lot. But please don't do this. It a) does not help D's popularity (if that is what you are trying to do , b) it makes you look like a troll or makes you look stupid (sorry)

Re: Ask HN: Why and how is Hacker News so fast?

#90

Earlier quoted context omitted.

No, forum.dlang.org is not crazy-fast. Other sites are crazy-slow. Write compact and easy-to-render HTML, it's no rocket science. Write some trivial CSS, you don't need Bootstrap. Make something dead-simple and call it flat design . If you have more than one stylesheet, concatenate them into one. Consider minifying. You don't need a 200 kB JS framework in order to fade in some hover menu. If you do need more than one…

What you're determining to be "needed" wrt design is very draconian and anti-progress. The web was ugly in 95 and appealed to few... progress in all areas -- especially design -- has made it what it is today.

What it is today, designwise, is awful, with screens littered with irrelevant content and extremely aggressive ads that are like xroach on steroids.
Post reply on HN