I’m an Elon Musk fanboy, drive a tesla and own tesla stock, I’m a true believer. One of the things I like about the man is the way he does everything in reverse, when it comes to efficiency and optimization. The attitude of most people is

‘This thing runs at 10m/s. How can we make it run at 12 m/s?

Whereas Elon takes the opposite view:

‘Are there any laws of physics that prevent this running at 100,000m/s? if not, how do we get it to do this?’

This is why he makes crazy big predictions and sets insane targets, most of which don’t get met on time, but when they do, its pretty phenomenal. If the next falcon heavy launch recovers the center core too, thats even more game changing, and right now, the estimate is that the falcon heavy launch cost is $90 million verses $400 million of its nearest competitor (which only launches half the weight anyway). That not just beating the competition, but thats bludgeoning them, tying them up, putting them in a boat, pushing the boat out into the middle of the lake, and laughing from the shore during a barbecue as the boat sinks.

When it comes to my favorite topic (car factory efficiency, due to me making the game Production Line), he comes out with even crazier targets.

“I think we are … in terms of the extra velocity of vehicles on the line, it’s probably about, including both X and S, it’s maybe five centimeters per second. This is very slow,” he said. Musk then added he was “confident” Tesla can get a twentyfold increase of that speed.”

Now we can debate all day long whether the guy is nuts, and over promising and whether or not we could ever, ever get a production line that fast, but you have to admire the ambition. You dont get to create privately-made reusable rockets without ambition. I just wish we had the same sort of drive in software as he has for hardware. The efficiency of modern software is so bad its frankly beyond embarrassing, its shameful, totally and utterly shameful. let me dredge up a few examples for you.

I’m running windows 10, and just launched the calculator app. Its a calculator, this is not rocket science. A glance at task manager shows me that its using up 17.8MB of RAM. I am not kidding, try it for yourself. I’m pretty sure that there was a calculator app for the sinclair ZX-81 with its 1k (yes 1k) of RAM. Sure, the windows 10 app has…err nicer fonts? and the window is very slightly translucent… but 17MB? We need 17MB to do basic maths now? As I type this, firefox has got 1,924MB of RAM assigned to it, and is regularly hitting 2% of my CPU. I’m just typing a blog post, just typing… and thats 2% of a CPU that can do 49,670 MIPS or roughly 50 BILLION instructions per second. Oh…we have slightly nicer fonts too. wahey?

I’d wager the percentage of people coding games who have any real idea how the underlying engine works is tiny, maybe 5%, and of those maybe 1% understand what happens at a lower level. Unity doesn’t talk to your graphics card, it does it through OpenGL or DirectX, and how many of us really understand the entire code path of those DLLS? (I don’t) and of those, how many understand how the video card driver translates those directx calls into actual processor instructions for the card hardware? By the time you filter your code through unity, directx and drivers, the efficiency of what actually happens to the hardware is laughable, LAUGHABLE.

We should aspire to do better, MUCH better. Perhaps the biggest obstacle is that most of us do not even know what our code is DOING. Unless you have a really good profiler, you can easily lose track of what goes on when your game runs, and we likely have zero idea what happens after our instructions leave our code and disappear into the bowels of the O/S or the graphics API. Decent profilers can open your eyes to this stuff, one that can handle displays of each thread and show situations where threads are stuck waiting is even better. Both AMD and nvidia provide us with tools that let us step through the rendering of individual frames to see how each pixel is rendered, then re-rendered and re-rendered many times per frame.

If you want to consider yourself not just a hacker but an ENGINEER, then you owe it to yourself, as a programmer to get familiar with profilers and code analysis tools. Some are free, most are not, but they are a worthy investment. Personally I use AQTime, and occasionally intel XE Amplifier, plus the built-in visual C++ tools (which are a bit ‘meh’ apart from the concurrency visualizer). I also use nvidias nsight tools to keep an eye on graphics performance. None of these tools are perfect, and I am by no means an especially good programmer, but I am at the very least, fully aware that the code I write, despite my efforts, is nowhere REMOTELY close to as efficient as it could be, and that there is plenty of room to do better.  If Production Line currently runs at 60FPS for you (average speed across all players is 58.14) then eventually I should be able to get it so you can play with a factory at least 10x that size for the same frame rate. I just need to keep at it.

I’ll never be the Elon Musk of software, but I’m trying.


11 Responses to “You should aim to be the Elon Musk of software”

  1. GBGames says:

    The post in which cliffski talks about the kinds of things that happen as a matter of course in the software industry outside of games.

    But not nearly as much as it could be even then. I know way too many people who code by the equivalent of throwing spaghetti at the wall and seeing what sticks, and they are working on the software that runs major infrastructure, vehicles, and websites.

    It’s kind of frightening, really, and they are perfectly happy being code monkeys and script kiddies rather than make their own jobs easier by just learning how to read compiler error messages (you don’t have to try adding semicolons randomly if you know the error is referring to the fact that you forgot to make your constructor public, for instance) or how the language they are using actually works under the hood. They get by, and that’s all that matters, and then they wonder why the world passes them by, whether in promotions, raises, or interesting work.

    And eventually when more populous nations or whatever advances in AI show up to do their jobs better than they do, they’ll actually be surprised at the fact that their jobs are in danger.

  2. Mr Weedy says:

    That calculator thing is weird. I’m running windows 7 (because I didn’t like how buggy windows 10 was when it got released and how it forced updates on your system without your permission and also win 7 works just fine even nowadays so why switch from something which works just fine?) and when I open the calculator progmran it’s using up 7,3 Mb of RAM. That’s 10 Mb more in windows 10 for…. what? Nice graphics with higher resolution textures?

    Even though wasting drives development and technology in its own way forwards because you need more compact and more powerful of everything in same amount of space because you have wasted so much previously to everything unnecessarely, but in the other hand that’s really bad way of advancing technology. You shouldn’t advance technology because there’s need for something more powerful because everything is so much wasted with the current technology but rather advance the technology because you can and because you want to do the same tasks with less computing power or with less space or something else meaning MORE EFFICIENTLY rather than developing more advanced technology because FORCED BY THE CURRENTLY HAPPENING EVENTS (or how you should say it).

  3. Nicolai says:

    Hey, at least the calculator is not an Electron app.

  4. Jeffery says:

    It is easy to talk about a 10X improvement. It is often not the laws of physics or math that prevents a 10X improvement, it is usually the laws of economics. Check out this table:

    Cereal yields/HA by country. From over 42,000 in UAE to 541 in Zimbabwe. Zimbabwe produced almost 1000/acre back in 1961. Clearly physics and biology are not the bottleneck here.

    There are a lot of areas where major breakthroughs are possible given enough funding. The main bottleneck is financial. Elon Musk is one of the rare few who are good at both technology and marketing. So he gets to take advantage of historically cheap interest rates to fund blue sky endeavors. The return on capital from Tesla is likely to be awful. But they did push forward EV adoption significantly.

    If you really want to be the Elon Musk of something, you need to be good at convincing people to invest in your project at possibly negative rates of return.

  5. hey says:

    That’s kind of a bad look because Elon Musk is a Trump-befriending, union-smashing asshole with no taste. There is a lot of productive people who are good and not as noisy.

  6. Michael says:

    I agree modern software memory efficiency is poor, but I think Elon Musk would call that some kind of secondary metric. Note he’s measuring velocity on the line and not the number of production steps or machines or power use of the building. I think that you would want to measure features released per week or something that your customers really want. I do appreciate when a game loads quickly and can stay in the system tray forever, but mostly I just want my favorite developers to release more games and updates so I can play their games more. Please interpret this comment as good-spirited. :)

  7. Joshua Harler says:


    If you want to squeeze more performance out of your next game (it’s far too late for PL), try ditching OOP. It might sound ridiculous, but hear me out.

    I’ve been programming in C++ for over 22 years now. For nearly 20 of those, I was a die hard OOP enthusiast. I studied it, applied it, loved it. Then I started watching Handmade Hero, and Casey made some really good points against using OOP. I decided to start writing a game using C style design. I was quite surprised by what I found:

    * It was easier to design. Not having to design a complex class hierarchy and trying to figure out how classes are going to interface each other without breaking OOP’s black-box ideology saves a ton of time.

    * It was easier to implement. Less boilerplate means less code to write.

    * It was easier to debug. Being able to read through a function and not have to worry about interfaces and virtual functions and constructors and destructors doing things that aren’t immediately obvious makes it simple to visually parse and understand what a function is doing without having to step through a debugger.

    * It was faster. Because you’re implementing functionality in a more simple way, there is less code being executed. My debug builds run nearly as fast as my release builds. I also don’t have virtual function overheads and making data cache-friendly is simple to do because nothing is a self-contained object.

    * It compiles faster. I also ditched templates and I use a unity build (all cpp files are #included in one cpp file which is compiled). This compiles 100k lines in about 3 to 5 seconds, full rebuild. This, along with hot code reloading has literally saved me hundreds of hours over the past couple years.

    After developing in this way for over three years now, I’m a firm believer and I’ll never go back to OOP, at least not voluntarily. If you really want to be more efficient in your coding and in your code, give it a shot.

  8. GBGames says:

    Musk is not measuring success by features delivered.

    He’s measuring success by how close we are to not killing ourselves with CO2 emissions or from not ensuring our survival in the event our planet becomes inhospitable.

    He’s not doing amazing things because he is thinking beyond minor optimizations. He is thinking beyond minor optimizations because he is trying to do amazing things, and you can’t get there from here by doing what you’ve always done but slightly better.

    • Michael says:

      GBGames, yes, I know that is Musk’s ultimate goal, but he isn’t measuring himself by the atmospheric CO2 count. He might be measuring himself by the number of people on Mars for fun but not to drive the company. Velocity on the line, number of successfully returned spacecraft, etc. are good goals because a) they are meaningful now, b) focusing on making them 10-100x better *necessarily* forces all kinds of important optimizations, c) they aren’t so long term that they detract from his companies’ viability.

      If Cliffski optimizes hard on resource use it’s not going to *necessarily* drive making the games great, but I bet he can find a good metric (probably not features, admittedly) that will drive efficient resource use as a secondary benefit.

      But I love the idea of a game developer having an “insane” long-term goal in addition to actionable metrics; it’s important to be inspired!

  9. David says:

    Weirdly I too had noticed that about the calculator in the past. Did you checked the amount of threads?
    My calculator is using 32 threads at the moment, I have a 2+2 calculation on it. That’s probably more than running whole windows 3.1 with the calculator :P
    That said it’s impossible that some things waste more resources, some take advantage of newer hardware better then others. The calculator is just a funny one we can measure with past ones.
    I think we can all do better.