Why Your Search Box Lags: Big O in the Real World

https://hackernoon.imgix.net/images/2jqChkrv03exBUgkLrDzIbfM99q2-rp022u5.png

You start typing into a filter and the letters stop arriving one at a time. They come in clumps. You type three letters and see nothing, then all three appear at once. The list is only a few tens of thousands of items. The machine is fine. The code looks fine.

It almost always is fine, except for one line.

That is where Big O lives in interface work. Not in a textbook chart of curves, but in a search box that falls behind your fingers once the list gets long. The chart at labs.sammii.dev/charts/big-o opens with exactly that, measured in your browser, and only then draws the classes to scale.

The one line

The demo is a list of generated items, each a pair of words and a number: "amber amber 0", "basil heath 1" and so on. Half of them are selected. Each keystroke filters the list and,...

Copyright of this story solely belongs to hackernoon.com. To see the full text click HERE

Read more