Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

From a NAND gate to Tetris was excellent. Informative and obvious

https://www.nand2tetris.org/



I cannot endorse this enough.

some of it is hard and will have you wondering if you want to continue. if you do, and I highly recommend that every developer complete this course, you will find yourself thinking in new ways and understanding many problems very differently, which is a very good thing.

and you will see huge performance problems in almost all software from them on, because none of this (I gesture vaguely at everything everywhere) should be as slow as it is. none of it.


Agreed. For me, the course was eerily able to hit my exact sweet spot of difficulty. Almost every project had me in the "I'm about to give up" stage just long enough before I had a breakthrough and kept continuing.

>and you will see huge performance problems in almost all software from them on, because none of this (I gesture vaguely at everything everywhere) should be as slow as it is. none of it.

Hah! Yes! After finishing, the first optimization I made was to add an "inc" command to the high-level (Java-like) language you implement. It annoyed me that any time you have "i = i + 1", it translates into VM code of "push 1 onto stack, push i's value onto stack, add, pop stack to i's location", each of which translates into several machine instructions. Especially given that the CPU has an increment instruction!

So I added the inc keyword that would ensure you bypass all of that, if you just want to increment a variable, and thus use significantly fewer cycles. It was really thrilling (well, as much as a technical project can be) to have the level of insight and control needed to make a change like that.


After reading that some huge percentage of x86 instructions are basically never used I’ve often wondered if there’s much more performance that can be gleaned through knowing what to write and how the compiler will use it.


The game inspired by the course is great, too: https://nandgame.com/




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: