4 ms·
> It was the smallest implementation of chess on any computer until its record was broken in January 2015 by the PC-compatible BootChess.[4] It would be intere
by antirez 8y ago
> It was the smallest implementation of chess on any computer until its record was broken in January 2015 by the PC-compatible BootChess.[4]
It would be interesting to compare x86 and Z80 code density, that is, how much you can do per bit of machine code.
- flohofwoe 8y agoNot a 'scientific' comparison, but handwritten 8-bit machine code compresses much less than x86/64 machine code (using gzip --best): - a compiled C executable for x86/64 compresses to about 38% of its original size (199 KB down to 77 KB) - a WASM blob of the same code compresses to about 32% (171 KB down to 56 KByte) In comparison some 8-bit ROMs: - ZX Spectrum 128 ROM (Z80): 16384 bytes compresses to 12189 (74.3%) - C64 Kernel ROM (6502): 8192 bytes compresses to 6735 (82.2%) So 8-bit code seems to be a lot 'denser' than today's machine code, and 6502 is denser than Z80 :)
- schoen 8y agoThat's interesting! Do you think this is because 64-bit code simply doesn't use a lot of its instruction set space (where more opcodes and instruction modes and variants are undefined and therefore not routinely used in executables), or because some of the people hand-writing 8-bit assembly actively use more opcodes than a typical compiler would, or some other factors? Or are there are a lot of pointers in 64-bit code that contain a huge number of zeroes? :-)
- flohofwoe 8y agoI guess it's a combination of compiled vs handwritten code (maybe certain patterns show up more often in compiled code, while handwritten 8-bit code tries hard to remove any redundancies because of the limited available space), and bigger data types (especially 64-bit pointers).
- antirez 8y agoVery interesting! Another thing to consider however is how much work each instruction can do. In that regard x86 may have a big edge.
- kayamon 8y agox86 was originally based on Z80 so it should be extremely similar (for 16-bit code at least).