, but there is nothing substantial I could say that hasn't already been
said better by Casey Muratori in his talk
. Generally, minimalism is the correct design choice for underlying
code, and this means it will be preferable for systems design as well.
So, as an analysis of code efficiency and hyper-minimalism, I compared snerx.com's
landing page source code to
gwern.net's
on 2022/4/11. As a caveat for fairness, snerx.com is coded by hand and gwern.net is
made using an HTML generator, which will always be less efficient, but the results are
interesting either way.
Gwern's site has
3,465 lines of code in the header alone, all to contain otherwise
minimal in-line CSS and a
handful
of scripts for things like link previews inside tooltips. Gwern's site then spends
another
1k+ lines to lay out the tables for links to his other pages, bringing
it to a whopping
4,895 lines of code total.
Conversely, Snerx's site has only
75 lines of code in the header, containing all
the CSS and animations. Snerx's site then spends only
23 lines of code for all
the content on the page including the table of links (which does not even require table
tags), bringing it to a total of
98 lines of code, and there are 18 comment
lines for some skiddie ASCII art that could be removed if you wanted to make it even
more compact.
For the same form of content, with similar functionality (modulo gwern's link preview
tooltips), snerx.com is
2% the size of gwern.net, or
50 times more
efficient (49.95 times, precisely), making it more than an order of magnitude more
optimized.
Coding a website by hand will always be better than relying on clunky and bloated
frameworks, and while I will never be able to make a
single-packet webpage like Yan Zhu
did, I have been able to make every single page on Snerx human-readable even when the
webpage doesn't render at all. As demonstration, below is an image of a browser render
and the raw source next to it. It might even be easier to read as raw source. Using
the underutilized 'pre' tag instead of normal 'h', 'p', and table tags is how I get
away with this and, at the sacrifice of responsive design, a lot of HTML content is
better served this way. I have also started making 'tempered' pages on snerx that have
the same source viewability without using pre tags, which keeps the source
functionality the same while allowing for rendered pages to be responsive.