Links and resources
Want to add anything? DM @logan b on Slack.
Tips and advice
- Don't worry about trying to optimise every line of code - most performance or speed gains come from larger architectural decisions.
- Instruct your compiler to optimise for size (
opt-level="x"for Cargo,-Osfor GCC, etc) - Use an executable compressor! It compresses your program and then inserts a small program to decrypt it back into a usable format. UPX and Crinkler are two popular ones.
Cool links
- Handmade Hero is a behind-the-scenes guide on what it's like to make a game from scratch.
Language-specific advice/resources
C
C has been around since the 70s and is one of the oldest programming languages still in use today. The upside of this is that there are SO many great resources available. The downside is that it doesn't have a lot of the conveniences that newer languages have.
Online resources:
-
CS50 Lecture on C (video)
This was my first introduction to C. It's taken from Harvard University's Introduction to Computer Science course, taught by David J. Malan (who Hack Club ran an AMA with)! The following lessons cover memory management and data structures. Also worth noting is their manual for the C standard library.
C++
Most of the resources for C can also be applied to C++!
Rust
Rust is a relative newcomer to the low-level programming languages space, and has a lot of features inspired from higher-level programming languages. These include a memory ownership system that makes it easier to prevent some common memory errors, and a package manager for easy installation of dependencies.
Beginner resources:
- The Rust Programming Language (online book)
- Minimizing Rust Binary Size
By default, Rust doesn't optimise for size and will output massive binaries compared to GCC, Clang, etc. While the size of a Rust binary will usually be larger than a corresponding C/C++ program, this repo shows some config options that can be set to reduce the file size.
Assembly
Note: You DON'T need to use assembly. Trust me. Only do this if you feel like torturing yourself.
With that aside, you can make some pretty cool things with assembly. Hack Club has a basic guide on how assembly and machine code works.