Data Oriented Design in the Frontend — Part 1: Introduction.

Pablo Weremczuk
3 min readApr 12, 2020

--

In this series I’m going to show why DOD is so important for modern software and why you should care.

I’m going to focus on frontend technologies that are used in the browser, but you’ll see that these principles applies to every programming language.

Data oriented design(DOD) is a way to take advantage of how modern computers are made. It’s a way to achieve mind-blowing performance gains.

Faster, Smaller, Simpler

You are going to learn to make your programs run faster, be smaller and simpler. All of this while making yourself more relevant as a programmer.

Browsers as Virtual Machines

Browsers become a lot like virtual machines, in the sense that they have a hardware abstraction layer, and can run programs closer to the hardware.

Still, web development is not catching up. The development ecosystem is polluted and the programs that come from the field are wasteful and inefficient. Web applications are too big, too slow, and consume too much electricity.

Energy Consumption is !Important

Power consumption is VERY important in the BIG (data centers) and in the small(mobile devices).

From the perspective of the mobile devices, slow software is the reason why we have to charge our phones several times a day.

Data Centers from companies like google, amazon, or Netflix, consumes as much energy as you can give them. There is a point that, no matter how much money you are willing to pay, you just can not have more energy.

This fact is wonderfully explained in the talk from Chandler Carruth from 2014: “Efficiency with Algorithms, Performance with Data Structures”

The idea behind this is that you want to create code that runs FAST, fast meaning that you are more efficient. That translates on saving processing power, which consumes less energy, that all together means that you need less money to run your business.

I’m going to give you two real-world examples of this:

1. A bank needs to escalate it’s Amazon infrastructure to provide acceptable services to their employees and clients. Don’t think only on production servers, but also in continuous integration servers that need to run a build for every pull request their developers create. Or High-Frequency Trading, a field that a microsecond is a lot of time.

2. A casino company that provides slot machines on mobile devices. The more time your players spend in the slot machine game, the more money you make. So you want your game to run fast to keep the phone battery charge as long as possible.

These are real scenarios that I face in my professional career.

Let me put it like this: slow programs are a waste of money.

Next Episode: An Important Concept

That’s all for today. In the next episode of this series, we are going to explore a concept key to understand how to make programs run FAST: Data Locality. Stay tuned.

--

--

Pablo Weremczuk

Past: Vox Populi, Vox Dei(a werewolf thriller). Working in a company created in 1690. Mixing low level programming with web development using Webassembly.