Raven's biggest feature is its speed, which we accomplish by (a) refraining from doing slow things, and (b) eliminating complicated abstractions that make it difficult to keep an eye on the code:
Limited Subset of C++. Raven's all C. We use C++ to overcome the inconvenient low-level nature of C — we use member functions,
lambda, and a gross
defermacro — but we don’t structure our app in C++: no private fields, constructors,
new, inheritance, polymorphism, RTTI, or STL. Instead of RAII we just zero our memory.
As a delightful consequence, when we want to know what our code does, we just read it. No more jumping back and forth between ten classes trying to mentally piece together a history of events. Slow code can no longer hide inside ten layers of nested classes.
Treat Errors As Another Code Path. We don’t use exceptions for error handling, because errors aren't exceptional. They should just be another code path with well-defined behavior. Our program doesn't suddenly do something mysterious (and potentialy slow) when an error happens.
Custom Memory Management. Calling
mallocis a great way to drop a frame. We allocate a huge chunk of memory at the beginning, then manage it ourselves using fixed-size buffers, stacks, arenas, and pools (see Game Engine Architecture). This (a) is much faster, and (b) forces us to actually think hard about our memory usage, instead of pretending we have infinite memory and being shocked when it turns out we don't.
This model of memory is actually more consistent with reality. We only get a fixed chunk of memory that we have to manage ourselves, you say? Kind of like an actual computer?
No External Libraries. When you’re building something hard, external libraries cost more than they're worth. Anything written by someone else is code you don't own. You end up having to (a) beat your program into the right shape to integrate with the library and (b) reason about your program in terms of the constructs the library gives you. God help you if the library has a bug, or does something stupidly slow.
Far better to own all of your code, so your program lies entirely within your field of vision and control. We only use two libraries in our whole app, ImGui and stb.
One Process, One Thread. Our whole app is one big update-render loop. No IPC, synchronizing multiple threads, or client-server architecture with JSON over HTTP. Poof goes a whole source of bottlenecks, complexity, and bugs.
We make exceptions; our parser uses threads to parse multiple files at a time. But we don’t use processes or threads to partition our application into modules.