The Lag Theorem

Let’s talk about software lag.

By “lag” I don’t mean things that take time in general. I mean delays that interrupt the flow of interaction, causing frustration. If your computer is downloading five gigabytes of data, compiling a large project, or rendering a video, those tasks may take a while — but that’s not lag. You asked the computer to do work, and it’s working. Now imagine the render finishes after an hour. The status changes to “Completed”, and the finished file appears on the desktop a second later. The first hour wasn’t lag, that last second was.

Theorem: every instance of lag is a bug, and can be fixed.

Technically, even displaying a status update or reacting to user input is work, just like rendering a video. However, this work must be completed in less time than a human can perceive. We’ll call that “instantly”.

Examples of lag in modern software:

  • you open an app and you have to wait before you can actually use it;
  • parts of the interface appear on the screen one by one;
  • clicking a button doesn’t produce an instant response;
  • characters don’t appear instantly as you type;
  • scrolling isn’t smooth or lags behind the user’s input;
  • while scrolling, content appears in front of the user instead of already being there as it enters the view;
  • when resizing a window, different parts of the interface redraw at different speeds or in several visible “jumps”;
  • when dragging an object, an app doesn’t instantly recognize that it can accept the drop;
  • after a menu opens, items are added or reordered in front of the user;
  • different parts of the interface respond to the user’s actions with different delays.

In the early days of computing, lag was unavoidable. Hardware simply wasn’t fast enough to make everything feel instant. That hasn’t been true for at least the last twenty years. The computers have long been orders of magnitude faster than what is required to achieve instantness and therefore eliminate all lag entirely.

If an application lags, it simply means that, at the moment it should have displayed something or responded to the user’s action instantly, it was busy doing something else. That “something else” is unnecessary work at that particular moment. That’s a bug, and it should be fixed. The unnecessary work should stop getting in the way of the user.

So lag cannot be blamed on weak hardware; it is solely the weakness of its author.