Flash Boys

Milliseconds Matter

Flash Boys has been on my to-read list for a while. I’d seen it referenced in passing as if everyone had read it. Michael Lewis writes about high frequency trading and the start of IEX.

I finally bought it after listening to the Joe Rogan podcast where he had on Andreas Antonopoulos who uses Bitcoin exclusively. Rogan mentioned the importance of physical location to fiber lines. That sounded like  a reference to high frequency trading. In the same week, IEX was finishing up their transition to an exchange.

I knew little about finance prior to reading Flash Boys. Now I have a better idea of how little I know. A lot more happens than people might think when they submit a trade online.

The importance of milliseconds
How long is a millisecond? Michael Lewis explains a lot of technical things in simpler terms. There are a lot of metaphors.

Lewis describes Brad and Ronan on their campaign to bring awareness to high frequency trading:

They never created a PowerPoint; they never did anything more formal than sit down and tell people everything they knew in plain English.

Lewis may as well be describing himself. I have no financial background but now understand the basics of high frequency trading. Humans aren’t great at thinking of numbers at scale, but Lewis does a great job describing tiny numbers in sensible ways:

…from Chicago to New York and back in roughly 12 milliseconds, or roughly a tenth of the time it takes you to blink your eyes, if you blink as fast as you can.

I played Counter-Strike in high school. LAN parties and all. And one of the things that LAN parties took away was latency. When we were on the server my friends played on, ping varied around 70ms (DSL) to 250ms (usually on a 56K modem, virtual god help the virtual you). Everyone begged their parents for DSL lines. Milliseconds mattered.

Milliseconds, microseconds, either one may as well be instant. Even seconds seems fast enough for a lot of things. What difference does it make?

There were one million microseconds in a second. It was as if, back in the 1920s, the only stock market data available was a crude aggregation of all trades made during the decade.

I like this stretching out of time to describe resolution. It reminds me of zooming in on the timeline in a video editor from 1 minute to 1 second.

Never before in human history have people gone to so much trouble and spent so much money to gain so little speed. “People were measuring the length of their cables to the foot inside the exchanges. People were buying these servers and chucking them out six months later. For microseconds.”

See the forest for the other forest

Flash Boys also shows the perspective of programmers in finance. I’ve been a programmer at a fashion company where technology is a means to an end. The relationship in finance seems more nuanced. The programmers care about the trees, of course. Details are important. They also care about the forest, but they don’t get a view into that other forest. That one over there. Yeah the one with trees that have dollar bills for leaves.

Talking to a programmer type about the trading business was a bit like talking to the house plumber at work in the basement about the card game the Mafia don was running upstairs. “He knew so little about the business context,” one of the jurors said, after attending both dinners. “You’d have to try to know as little as he did.” Another said, “He knew as much as they wanted him to know about how they made money, which was virtually nothing.

What do programmers do, anyway?

[…] the entire platform had as many as 60 million lines of code in it and fifteen years of fixes to it had created the computer equivalent of a giant rubber-band ball. When one of the rubber bands popped, Serge was expected to find it and fix it.

Spot on. There’s the phrase “spaghetti code” for things that are getting out of hand. Rubber-band ball goes a step further. The older the root of the problem, the deeper you need to go to fix it. And you need to keep the other layers in order.

Something that might be hard to explain is lines of code. I don’t have a good idea of how many lines of code is equal to what. Staying abstract I don’t know how many lines would be in 1 KB, not to mention a MB. How many lines of code is jQuery?1

The size of code comes up in the chapters following Sergey Aleynikov (Serge). He sent Goldman Sachs code to himself before leaving his job. Most was mostly open source, but with modifications to work with their system. Why would he take it?

“In Serge’s case, think of being at a company for three years, and you carry a spiral notebook and write everything down. Everything about your meetings, your ideas, products, sales, client meetings—it’s all written down in that notebook. You leave for your new job and take the notebook with you […]”

You’re not going to read through a notebook word for word, but it’s good to have for reference. How much code was it all anyway?

Most were surprised by how little Serge had taken in relation to the whole: eight megabytes, in a platform that consisted of nearly fifteen hundred megabytes of code.

Not much at all. Or is it? Without looking it up I don’t have a good sense of what 8 MB is. I can try to break it down:

  • 8MB of 1500 MB is 0.5% of the code base
  • 0.5% of 60 million lines (estimate above of entire platform
  • 300,000 lines of code

Which sounds like a lot, but I imagine it’s mostly libraries. But I also just have no idea. And I’ve been paid to program. Guess who was supposed to build up some sense of what this was then decide Sergey’s fate?

The jury in Sergey Aleynikov’s trial consisted mainly of high school graduates; all of the jurors lacked experience programming computers. “They would bring my computer into the courtroom,” recalled Serge incredulously. “They would pull out the hard drive and show it to the jury. As evidence!”

I’ve done jury duty and it reminded me that everyone goes. Your coworkers. Your barista. Their mom. Their doctor. I can convince my parents that technology can do anything or nothing. They’d almost certainly be swayed by someone waving around a hard drive.


  1. “One line if it’s minified!” Go back to your brainteaser book. ↩︎

In your head, then on paper, then on screen

I guess it’s pretty clear that the programming portions of Flash Boys were most interesting to me.

They had been forced to learn to program computers without the luxury of endless computer time. Many years later, when he had plenty of computer time, Serge still wrote out new programs on paper before typing them into the machine. “In Russia, time on the computer was measured in minutes,” he said. “When you write a program, you are given a tiny time slot to make it work. Consequently we learned to write the code in ways that minimized the amount of debugging. And so you had to think about it a lot before you committed it to paper. . .

I don’t plan as much as I should.

Even with this website (and its previous Jekyll iteration), I open the files up and do some HTML/CSS edits. Live coding! I think there’s a place for it but for laying content out I think the results will nearly always be better by doing it in a graphics editor first.

When I’m designing in code, a lot of it ends up being ready, fire, aim. Then I stop when I have something acceptable. There’s a chance it’s good, but it’s unlikely to be great.

Doing a layout on paper and then in Sketch (or other graphics editor.

On a project with a team, there’s usually some kind of project management. Design and development might be done by completely separate people so this isn’t tightly coupled.

Working on this site solo, I just need to be better about remembering to plan and design before writing any code. I’ve tried restricting my time by saying “Oh I’ll only tinker on the weekend. I’ll write during the week.” The restriction is artificial though, so I’d find myself in a code editor on any random day instead of writing.

This time around I’m just keeping an updated list on a todos page. It gives me the satisfaction of knowing it’s written down somewhere that I might possibly get to down the road. Then when I set time aside to tinker, I’ll have a list of things to better prioritize.

It’s not quite programming on a 1980s machine with a limited amount of computer time. Or programming on paper while in prison. (Like Serge did later on.)

This reminds me of something from Founders at Work. The del.icio.us founder talks about building the site in small pieces over years.

I could come in and look at it, figure out what I’m doing, do it, and be done for the day in 15 minutes. So if I could get one thing done a day, I was happy. A lot of stuff, if I could spend more time, I did, but as long as I could get one or two things done a week total, if I didn’t have time, I didn’t have time.

If I didn’t have time, I… skipped sleep to get it done, stressed over it, got frustrated? Those are certainly options, but a lot of times it might be best to just not do it.

It’s one of the luxuries you can take with a side project. And I’d say it’s a luxury you need to take if you’re in it for the long run.

Todo: break the items in the todos page into smaller pieces.