News for hackers. Stuff that matters.
Re:Ask HN: Why and how is Hacker News so fast? by FraaJad on Sunday August 02, 2015 @10:04AM (#9990763)
If you want to see an even faster "forum", see

http://forum.dlang.org/

Re:Ask HN: Why and how is Hacker News so fast? by jonahx on Sunday August 02, 2015 @10:14AM (#9990790)
That's impressive. What is their architecture?
Re:Ask HN: Why and how is Hacker News so fast? by aw3c2 on Sunday August 02, 2015 @10:16AM (#9990802)
http://forum.dlang.org/help#about says

> This website is a web frontend to the DigitalMars NNTP server and mailing lists. It is part of DFeed, which is also a D news aggregator and IRC bot.

> DFeed was written mostly by Vladimir Panteleev. Portions (including style and graphics) are Copyright © by Digital Mars. The source code is available under the GNU Affero General Public License on GitHub: https://github.com/CyberShadow/DFeed

Probably as static as possible, speed is easy then.

Re:Ask HN: Why and how is Hacker News so fast? by mootothemax on Sunday August 02, 2015 @10:54AM (#9990922)
>Probably as static as possible, speed is easy then.

With an empty cache, every asset except font awesome is getting to me - here in Poland - in under 200ms, with some under 150ms.

For 22 requests - even with a total payload of "only" 155kb - whether static or not, that is seriously impressive.

Re:Ask HN: Why and how is Hacker News so fast? by colloqu on Sunday August 02, 2015 @10:16AM (#9990797)
This one is crazy. How are they so fast?
Re:Ask HN: Why and how is Hacker News so fast? by currysausage on Sunday August 02, 2015 @11:03AM (#9990951)
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 JS file, concatenate them into one. Minify/uglify and move the <script> tag to the bottom of your HTML.

You don't need 2 MB worth of stock photos. Recently, there was a page on HN with an uncompressed 12 MB banner photo. That is insane.

You don't need those heavyweight social plugins, they ruin your day (performance-wise). If your content is great, people will find a way to share. If your boss specifically asks for Facebook and Twitter buttons, just link to https://www.facebook.com/sharer/sharer.php?u=http://www.exam... and https://twitter.com/home?status=This%20is%20great:%20http://.... [1]

Don't just embed YouTube iframes, they are even worse. Use yt-embed.js [2].

Is a web font really necessary? If it is, do you really need Bold Italic? Sure as hell you don't need Ultralight+Light+Semilight+Regular+Bold, just because there is one ubercool Ultralight tagline in the footer.

Make sure Nginx or Apache gzip HTML, CSS and JS and send far-future Expires headers for all your static assets. Make sure that there are no redirects, they add latency.

If you follow these simple rules, your page weighs under 50 kB and needs no more than 10 HTTP requests. You don't even need complicated CMS caching and CloudFlare. But hey, there are some 10,000 cache plugins for WordPress, just install one.

[1] http://www.sharelinkgenerator.com/

[2] https://gist.github.com/do18/09761dfabf60689b2cd8

Re:Ask HN: Why and how is Hacker News so fast? by mootothemax on Sunday August 02, 2015 @12:12PM (#9991183)
>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.

Re:Ask HN: Why and how is Hacker News so fast? by currysausage on Sunday August 02, 2015 @12:38PM (#9991292)
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? by vram22 on Sunday August 02, 2015 @05:10PM (#9992490)
Lot of good points, thanks.

>You don't need 2 MB worth of stock photos. Recently, there was a page on HN with an uncompressed 12 MB banner photo. That is insane.

That seems to be a big trend nowadays and a huge pain.

Re:Ask HN: Why and how is Hacker News so fast? by azinman2 on Sunday August 02, 2015 @12:35PM (#9991281)
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? by currysausage on Sunday August 02, 2015 @12:45PM (#9991325)
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? by jibalt on Sunday August 02, 2015 @03:07PM (#9991942)
What it is today, designwise, is awful, with screens littered with irrelevant content and extremely aggressive ads that are like xroach on steroids.
Re:Ask HN: Why and how is Hacker News so fast? by Trioxin on Sunday August 02, 2015 @01:12PM (#9991414)
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? by srean on Sunday August 02, 2015 @01:44PM (#9991523)
> 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? by Trioxin on Monday August 03, 2015 @03:23AM (#9994249)
I said that because when I lookup the benchmarks, that's what I see. I'm sure if I setup similar benchmarks of my own I'd probably get the same results (Unless the people who posted those that I've seen are lying and for some reason I doubt that).

You should think before calling someone a troll or saying that they sound stupid when they're citing information from an outside source. If I didn't think Dlang had a performance benefit I'd have a bit less incentive to use it. Are you saying such benchmarks are false? They seem legitimate to me. Search and view them yourself. If I were a troll I'd do something like you did, citing no evidence. Commenting in such a way without citing data makes YOU sound stupid (Sorry).

Re:Ask HN: Why and how is Hacker News so fast? by Trioxin on Monday August 03, 2015 @10:46AM (#9996218)
Re:Ask HN: Why and how is Hacker News so fast? by Trioxin on Monday August 03, 2015 @05:19AM (#9994623)
To be fair, I'll run my own benchmarks at some point. For now, I have to rely on what's out there.
Re:Ask HN: Why and how is Hacker News so fast? by h1fra on Sunday August 02, 2015 @03:56PM (#9992160)
Wow quiet fast indeed, in my experience the fastest dynamic site I browse is kickass torrents (=> no link for obvious reason) With cache enabled they both take less than 150ms to render a full page which actually should be a standard but seems really really faster than any sites I visit everyday
Re:Ask HN: Why and how is Hacker News so fast? by srean on Sunday August 02, 2015 @11:26AM (#9991032)
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 encounter trained listeners breaking out into a (silent) applause. At those instances I feel bad because I realize I have missed something but I wish I didn't. So all pointers appreciated.

Re:Ask HN: Why and how is Hacker News so fast? by bradleyland on Sunday August 02, 2015 @11:49AM (#9991095)
How fast is your network link, both in terms of throughput and latency for the sites you visit? The OP is browsing over a 256 kbps connection of unknown origin. They are likely impacted by latency and throughput constraints, which will exacerbate issues with sites that require a lot of requests or are resource heavy.

Making a site fast boils down to:

1) Making sure your server responds quickly.

2) Reducing the number of requests required for a page to load.

3) Reducing the number of bytes required for a page to load.

Re:Ask HN: Why and how is Hacker News so fast? by mootothemax on Sunday August 02, 2015 @12:15PM (#9991198)
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.

Re:Ask HN: Why and how is Hacker News so fast? by srean on Sunday August 02, 2015 @12:28PM (#9991255)
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? by technomancy on Sunday August 02, 2015 @11:42AM (#9991071)
> Am I not visiting enough of the slow sites?

Do you use NoScript? I feel the same way because I usually run with JS turned off. Most things are pretty zippy despite using a computer from 2009.

Re:Ask HN: Why and how is Hacker News so fast? by srean on Sunday August 02, 2015 @12:26PM (#9991244)
Ah! that and flashblock might explain it.
Re:Ask HN: Why and how is Hacker News so fast? by tuyguntn on Sunday August 02, 2015 @05:02PM (#9992475)
Wow, really fast, feels like fully loaded single page app and only downloading jsons