Digital pollution
sivers.org
sivers.org
It helps that I know to uncheck "save with Illustrator compatibility" so it doesn't cram a whole text-encoded .AI file into the back of the SVG; I also drew one 5-pt polygon instead of a pair of 3-pt triangles.
Which does not invalidate his core point about "holy crap some machine-made files are stupidly huge". But hand-writing SVG is like trying to hand-write assembly for a modern CPU - collectively, the people who wrote the compiler probably know more clever tricks about optimizing code than you ever will.
Oddly enough if I prune out the four seemingly-superfluous points that result where the shapes overlap it goes back up to 125. SVG's path compression is weeeird.
13 points, 122 bytes: <svg viewBox="0 0 54 54" xmlns="http://www.w3.org/2000/svg"><path d="m27 23-27-27v4 27 27h4v-27h46v27h4v-27-27-4z"/></svg>
9 points, 125 bytes: <svg viewBox="0 0 54 54" xmlns="http://www.w3.org/2000/svg"><path d="m27 23-27-27v58h4v-27h46v27h4c0-12 0-46.1 0-58z"/></svg>
d="m27 23-27-27v4 27 27h4v-27h46v27h4v-27-27-4z"
to
d="m27 23-27-27v58h4v-27h46v27h4v-58z"
The cubic bezier curve in your second version seems like some kind of strange artifact.
Far inferior in human-friendliness to read and edit. But less bytes, and editing would realistically involve loading up the AI source file I didn't bother saving and generating a new SVG.
ugh.
Numbers like 10 30 became 10.0000023 29.9999948 and basically everything became complicated.
It was like running a one-line program through a compiler and then a disassembler.
They will continue to function for the foreseeable future, with zero build process, no node_modules directory full of tens of thousands of garbage files, no transpiler or bundler version issues, and almost no overhead in understanding the code, even for a bug fix 5 years down the line.
But, I still get funny looks if I tell my front-end friends all this. Sometimes I feel a little crazy.
There used to be a huge need to jquery, bootstrap, polyfills, and other tricks, but many of those features are now available in the built-in languages. If you ignore IE, then you can make elaborate websites just by writing it by hand, doing some plain css grid, svg, html5, etc. How much time is spent resolving npm dependencies and packaging scripts for simple libraries that used to just be adding a .js file to your repo?
Obviously, web applications (that do more than show some content) will need more infrastructure, but I feel like we can safely stick with mostly vanilla languages for web pages that is content-focused. Let's go back to the days where you could learn a lot from View Source, and version control was dead simple.
But I have just imported the Vue code as a script file - no node modules folder ;) Though without Webpack I can't do single-file components properly, which sucks.
This also doesn't scale. Where do you start with the garbage? As soon as you start with the OS, you're dealing with a stack of trash. Every layer adds more junk to the pile. Even considering where you should start cleaning is huge decision overhead. Every decision is a potential rabbit hole which can lead to problems. Mo' decisions, mo' problems. Better to keep the decision space clean. I would rather my trash be digital than cognitive.
This is what matters, in my humble opinion.
I'm working on a small side-project (https://visalogy.com) that the entire site is using less than 20KB JS, and 25KB of CSS. Logo is half a KB, ridiculously small over Brotli/GZip. A fully functional site weights less than 150KB with all assets.
Instead of doing everything by hand, this digital pollution can be removed with proper building process. Automate image compression, uncss, svgmin, etc to the CI pipeline and you will have the best of both worlds.
On the one hand, popular opinion in the profession is to encourage you to launch your product as quickly as possible and then revise rapidly. That naturally leads the developer to reach for time-saving libraries, templates and frameworks. Even, if you're not launching a product, you still reach for a framework because it makes you - to use a favourite term among developers - 'productive'. In other word, everything for the comfort of the developer.
On the other hand, when the developer is on the receiving end of a memory-guzzling app, or a bloated website, they will complain loudly and eagerly point the finger at the designer, the Product Manager, the stakeholders, the boss or whoever - always someone else to blame. What developers won't do is acknowledge that attitudes and practices in the programming profession are the root of many of these problems.
I sometimes wonder if programming is the only profession where so many people aspire to the lowest possible standard, while holding everyone else to a much higher one.
Isn't that just life?
I'm not saying perf isn't a feature but if you're playing svg golf you're just doing it for the sport and not the user value and not some altruistic digital pollution argument.
Now we have npm and webpack doing this for Js. It's convinience vs purity.
But now I think the same argument can be made for using C++ over assembly language.
I doubt about the convenience part. With more moving parts, you sooner or later run into problems you couldn't anticipate. I'd rephrase it as "immediate and deceptive feeling of convenience vs. purity and convenience"
The same thing applies to code too. There's the principle of using frameworks wherever possible that especially novice programmers stick to without realizing how much harm it can do in the long run.
My personal record is reducing the main code base of an app about 20 times (!) by just removing unnecessary frameworks and replacing others with better ones. No, 20 times applies to the main code, excluding the frameworks. This is the same kind of digital pollution.
Digital stuff such as graphics files, source code, etc scale too easily unfortunately for all of us, developers and users. Every time I open someone else's big iOS project I find about 80% of 3rd party code linked for no good reason. Let alone some essential frameworks that themselves create pollution by pulling endless dependencies (Google being one of the top offenders from my experience).
This is not going to change unfortunately. Digital media is cheap, easy to scale, usually a bit too expensive to get right (i.e. to reduce pollution) and at the same time it's not always easy to see the drawbacks of pollution in the long run.
Not everyone’s ideal use of a day, especially when the work is already done and the drop in file size helps (almost) no one.
You can even color SVG with CSS, making it easy to integrate single color icons into color schemes:
https://css-tricks.com/almanac/properties/f/fill/
edit: sigh, I don't know if that's for suggesting to use Inkscape and then remove stuff manually, or for linking css-tricks... so I'll answer to both hypothetical criticisms:
1.) You can't make something like this, as simple as it is, purely by entering numbers into a text file: http://b.sandboxx.org/icons/autonomy.svg
2.) I couldn't find a better page on fill, MDN for example flat out pretends there is no such CSS property, redirecting to SVG: https://developer.mozilla.org/en-US/docs/Web/CSS/fill
But I know CSS has this property because I'm using it, and it's awesome. You obviously don't need it on a site that just has one color scheme, or if using either black or white outlines depending on background is good enough -- but if you want icons that scale and fit any color scheme, and want to avoid digital pollution, this is something you should be aware of.
It's perhaps not that large an exaggeration to suggest that rush hour commuters, one per car, are doing exactly this to each other.
However, I would find it very hard to justify the extra time for these benefits.
There are simply too many more valuable things I could create with this time.
In any case, I think doing something from first principles is important to understanding a faster tools-based approach.
Our pages were written in PHP by an idiot, a true berk. He liked long lines, heavily indented. Lots and lots of indentation. LOTS of indentation.
I noticed this one day and did a quick bit of hacking to see how much of our traffic was just whitespace. Twenty-five. 25%. One out of every four bytes of our (non-image) traffic was 32 (0x20).
(And, yes, I brought it up, and, no, no one else cared. The CEO was eventually replaced by the investors and now the company is a big ol' success. FWIW)
I had the same thoughts in mind when writing https://concrete.style and https://louismerl.in.
So be wise before inflicting this staggering bullshit on your colleagues. Pick your battles.
Also don't overlook that just one byte more can double the amount of packets that need to be sent for something, just a little bloat can mean individual items in a list of millions no longer fully fit in the CPU cache, and so on. We also can't really know how many times things (that are put on the web) get handled by how many computers and users, so any byte you save could be multiplied by infinity. If I can do it easily, cutting out bloat is always good IMO. Personally, I find it enjoyable.
I do have a new line at the end of files now so that Git doesn't complain. That and new lines before some curly braces (either JS/TS/C#, can't recall which) is the only thing I've changed over the last decade+. The fact that I don't recall which I do where suggests I might want to reevaluate that, if it's not in a language that's going to compile it out.
The problem is that this attitude leads not only to waste and inefficiency but also to insecure, unreliable, buggy systems that are incomprehensible even to the people who build them, because they are built on layers of poorly understood, overly complicated trash.
So we have laziness, incompetence, and waste at every level of the stack, and this is celebrated as efficiency.