3 ms·
The best analogy is sorting forks, knives, and spoons when we are putting them in drawers. We can throw all silverware together. But then finding a spoon in tha
by nkurz 6y ago
The best analogy is sorting forks, knives, and spoons when we are putting them in drawers. We can throw all silverware together. But then finding a spoon in that pile will take time whenever we need a spoon. The task changes from getting a spoon (execution) to finding a spoon (identification). And that's a cost we want to avoid.
I agree with his overall point about the costs of context switching (and was disappointed that he didn't talk about the low level issues of coordination on multithreaded systems) but this seems like an odd candidate for "best analogy".
When I moved to a new house a few years ago, we initially lacked an organizer tray as is typically used to keep silverware sorted in the drawer. Our solution, which we thought was temporary until we bought one, was to unceremoniously and clatteringly dump all the silverware into the same drawer, and to pick out what we wanted at mealtime.
Three years later, we're still doing it and have concluded that it's much better system. Sorting silverware was always one of my least favorite parts of putting away washed dishes, and now it is trivial: dump the entire basket from the dishwasher into the drawer, often while grinning with joy. And I don't think I've once become angry at the extra time of searching for a spoon or a fork.
Consider, if we're being technical, that the primary advantage of presorting happens when you can sort once and take advantage of the ordering many times. But with silver, it's once-in and once-out. Sorting all at once isn't actually faster, it's just preloading the pain. Also note that you can fit a lot more silverware into a drawer unsorted. Having twice as many spoons and forks might reduce utilization, but silverware is cheap and having more makes finding what you want a lot easier.
Anyway, you know the standard advice to measure before you optimize? Given my positive experience with the unsorted method, I wonder if he's even tried the approach he's using as a central negative example. Personally, I'd suggest that more people should try it!
- henrikschroder 6y ago1) Buy a dishwasher with a third rack. 2) Sort silverware when you put it into the dishwasher. 3) ??? 4) Profit! Actually, just buy a dishwasher with a third rack regardless, because it's so much better.