Search speed - an experiment

I see lots of requests to filter data, and was curious about which of two options was fastest. I did an experiment:

Setup: Data in a Google Spreadsheet. I have 668 rows of data. In the category column, I have equal numbers of A, B, C, and D categories. In the Authors column, each author is represented once or twice. Note that I get the column values from the Google Sheet just once, and it isn’t in my time calculation.

I start by grabbing a list of all values in the column to be searched.

Then I either iterate through each value, or I use list searching functions. You can see the two possibilities in the screenshots below:
Option 1:

Option 2:

So what’s faster?
If I am searching for two instances of a name in 668 rows, option 2 is faster. About 10-15ms, vs 250ms for option 1.
If I am searching for 168 instances of a category in 668 rows, both options are 250ms+.

Take-home: If you are looking for a rare occurrence in your list, using a search like option 2 is going to save you a LOT of time.

Want to play with it yourself?
and then you’ll need to link it to some data, like this set: Copy of QuotesSpreadsheet - Google Sheets