Math and Assembly Are My AAA Bonds

I’m Ukrainian and I can’t save my money.

I can’t save in cash. I learned this early in life when I got a summer job to buy a new second-hand monitor. Mine was in a pretty bad shape, it kind of worked but needed manual adjustments all the time. I really wanted to replace it just so I could work and play in peace. So I held my job for a couple of months, but by the end of the summer, I still lacked some cash so I decided to wait until next year.

Unfortunately, the year was 1998. Ukraine’s currency plummeted more than twofold that fall, and so shrunk my modest earnings. Well, there’s not much you can do about it, lesson learned: I can’t save in cash.

I can’t trust banks. In 2004, all ATMs went empty in a day; in 2008, my bank refused to pay off deposits and went into receivership; and in 2014, my assets were frozen due to “suspicious activity”. From my standpoint, there is nothing suspicious in cashing in when there is a war around but ok. I learned my lesson. I can’t trust banks.

I also can’t invest in real estate. In April 2014, my hometown was occupied by Russia. And although it was brief, we were lucky to be liberated by July, this, of course, dropped the market to the ground. I had to help my parents with relocation, so I sold my own apartment for trinkets. With this, and the money I still managed to fight back from a bank, my brother and I bought them a house far away from the front, so all is well that ends well.

Financially though, it was 1998 all over again.

Also, the legislation in Ukraine isn’t friendly to long time investments. I can’t buy land, I can’t buy stock without a third-party broker, I can’t even own collectible firearms legally. These make a surprisingly good investment since they are made to last for decades and their market can’t suddenly become oversaturated. But in Ukraine, I can only register up to five items as hunting weapons, and even still, the police have the right to confiscate them all if, for instance, I don’t pass a bi-yearly physical.

So my options are limited. The only thing they can’t take away from me is my head. So I invest in my skills and knowledge, and I have to say that so far, the most reliable investments were, as it says in the title, math and assembly.

Reliable doesn’t mean profitable. Credit rating places the instrument on the scale from risky to secure. Risky may grow up in cost immensely, but they may as well plummet. Secure ones usually grow slowly and steadily. Most of the pension funds invest in the latter, most of the fast money is made (or lost) on the former.

This goes to skills and knowledge as well. Some are hot and trendy, and they get you a good job fast. But in ten years they grow obsolete since there is a new fad on the block, and everyone now wants this not that.

When I went to college, these were hot and trendy: Delphi, DCOM, T-SQL, Java-applets, Flash and Silverlight, UML and RUP. All aged like fine milk.

Now, fifteen years after graduation, the things I picked at college and still use are the most boring and uninspiring subjects: it’s linear algebra, analytic geometry, differential geometry, discrete mathematics, and maybe surprisingly, assembly.

I rarely write in assembly, but I read it all the time. I read CIL for C#, Intel x86 for C++ on Windows, and AT&T x86 for C on Linux. I read CUDA for GPU, and ARM for mobile. This helps me understand the compiler, and to use it most efficiently.

Just a few weeks back I peeked into a piece of CUDA code and found a function there that wasn’t originally in the sources. It appeared to be a routine for int64 division. Why do we want it in the code? We don’t. It’s just one of the indices was passed into the kernel not as uint32_t but, conventionally with the rest of the code, as size_t. It was not even a mistake, just something nobody thought essential.

It’s a small thing, but this extra function costed us like 10% of the run time. Run your code in a cloud 24/7 on a couple of Teslas, and when you get a bill from Amazon, take 10% of it. That was saved by spending five minutes browsing through disassembly and then changing one size_t to uint32_t.

And this happens all the time. Compilers are just not smart enough to be trusted completely. They still need your supervision.

I can supervise compilers. I’m also comfortable with math-packed code. This wasn’t a huge career boost early on, but now my “AAA bond interest” is finally stacking up. My value on the job market grew slowly but steadily and, at this point, not only do I do financially well, I’m also certain that I will not become unemployed when the next crisis strikes.

I want to give advice to all the young folks who are getting into the industry today. Invest in your head. Invest wisely. Diversify. Have some “junk stock”, something new and shiny just to get in. Any hot JS framework will do. Have solid middle ground options: good programming skills, basic algorithmic knowledge, debugging and profiling skills. But please don’t forget about “AAA bonds”. No matter what happens, your code is still executed by a machine. No matter how markets behave, a differential equation is a differential equation. So assembly and math will never get old. They are just as reliable as an oil-soaked Schmeisser well hidden under the garage floor.

Quickload at English Wikipedia, CC BY-SA 3.0, via Wikimedia Commons

Not saying that I have one.