News for hackers. Stuff that matters.
Re:The true cost of linked lists by amag on Monday June 06, 2022 @09:16AM (#31640040)
> For real world performance, benchmarking is the key.

Only it's not enough. When you benchmark an O(N^2) algo may seem fine but then three years later the data has changed and is now an order of magnitude larger. So you need not only know your data, you also need to spend time thinking about how large it can become.

Re:The true cost of linked lists by quietbritishjim on Monday June 06, 2022 @10:57AM (#31641298)
You seem to be agreeing with the parent comment's point. For example, there's this bit of their comment, which is almost verbatim what you replied back with:

> ... you might encounter cases where a quadratic complexity solution is completely fine, until you have a lot of data and then suddenly your code slows to a crawl [0]. That's why we need computational complexity ...

It seems like you're disagreeing only because you pulled out the one quote about benchmarking. But they were just saying that you need benchmarking to bootstrap the meaning of O(...) of an algorithm. That's the point that the original article missed, which is presumably why they described it as key.

Re:The true cost of linked lists by robby_w_g on Monday June 06, 2022 @10:20AM (#31640853)
> When you benchmark an O(N^2) algo may seem fine but then three years later the data has changed and is now an order of magnitude larger

The GTA Online loading screen bug is a recent example of this problem, with its in-game purchasable items growing larger over time: https://nee.lv/2021/02/28/How-I-cut-GTA-Online-loading-times...

Re:The true cost of linked lists by inetknght on Monday June 06, 2022 @09:59AM (#31640571)
> Only it's not enough.

True. But I do highly recommend watching Ben Deane's 2015 talk about testing Battle.net. In it he briefly touches upon benchmarks and estimating algorithmic complexity. It's somewhat difficult to suss-out the details of it. But the short version is basically to run the benchmark with a few different sizes and then estimate the complexity growth from that.

https://youtu.be/OPoZWnYIcP4?t=1035

Re:The true cost of linked lists by Ozzie_osman on Monday June 06, 2022 @09:36AM (#31640250)
That's the point of O-notation though. It helps you know how your computation will degrade as your data grows.

So you start with benchmarking your current data. You still need to always think about how your data will grow.

Re:The true cost of linked lists by favorited on Monday June 06, 2022 @07:38PM (#31647936)
> the data has changed and is now an order of magnitude larger

If your data changes, and you care about performance, then your data structures and algorithms should be reevaluated.