Blast from the demoscene past
June 2009
Do you like the demoscene? Or do you just like smaller, faster, or embedded code? Read on.
When I was 14, I started learning how to program, for at least two reasons:
- My dad could code, and he made some neat stuff, like a code-generating pentomino puzzle solver and a really tiny pop-up editor.
- Because I really liked the demoscene.
Scratch that. I still like the demoscene. I mean, who else can make incredible 3D tube or lattice demos in a 256-byte executable? Try them — both still run fine under Windows XP.
So I read diskmags and tutes to learn how to program the VGA hardware, push pixels to 0xA000:0000
, and use Mode X. Oh, and I learnt about sin
and cos
before I learnt at school — for basic 2D and 3D rotation. Then there were effects: the fire effect, plasma, starfields, wormholes, etc, etc. (Click on the piccy to the right to download some of my old source.)
Anyway, back from Second Reality to the real thing …
As I’ve noted before, I’m not exactly in favour of bloatware. But in today’s “a GB here, a GB there” world, is small still beautiful? I think so, for two reasons:
Embedded programming
In the embedded world, size still matters a lot. Microcontrollers are getting bigger and faster, sure, but in electronic products there’s often a place for the small ones (say 64KB flash, 2KB RAM). Just the other day, I cut our code size by 900 bytes, which was a significant percentage of the total — less code to download, test, and maintain.
And it’s not only important for small micros, but also to limit download time and cost for in-field updates. If you want to update code for 1000 units over a fairly slow and costly radio link, small is good.
Binary diffs or deltas are really good for this. My brother Berwyn has developed a proof-of-concept binary diffing algorithm which is designed for tiny embedded systems — contact us if you’re keen to hear more.
Binary diffing isn’t new, of course — bsdiff already does something similar for Firefox’s updates, so you only need to download a small update. But bsdiff doesn’t work on small embedded systems, because it uses a compression program which requires a fair amount of RAM (bzip2).
To go fast, do less
Yep, as the guy said: To go fast, do less.
And KISS. Keeping it Short and Simple means less code to test, and if you’re using basically the right approach and algorithm, it usually also means faster code. And to follow my own advice, I’m keeping this section short.
Conclusion
In a word, if you’re a budding hacker, or the parent of a budding hacker, teach them that small is still beautiful. And get ’em started with the demoscene. There is still a pretty active ‘scene community, and here are some starting points:
- Wikipedia article on the demoscene
- Pouet.net, a great place to download popular demos
- Scene.org, another good ‘scene resource
Comments
Adam 25 Jun 2009, 18:11
I agree. I work for Bittorrent, and we still manage to reduce code-size in uTorrent even at this late stage in the program’s development. More room for new features!