Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re: Be aware of splice

by tilly (Archbishop)
on May 03, 2004 at 18:23 UTC ( #350106=note: print w/replies, xml ) Need Help??

in reply to Be aware of splice

This example illustrates an additional point about algorithmic efficiency.

BrowserUk had initially thought that the algorithm wasn't quadratic because it didn't look quadratic in runs of 10, 100, and 1000 elements. But it did look quadratic when he tested 10_000 and 100_000.

The reason is that the quadratic piece all consists of copying pointers in C, which is very fast. You do a lot of it, so it doesn't scale, but for small sample sizes the eventual performance bottleneck is invisible. And then once the performance bottleneck becomes visible, it doesn't take long until it dominates.

Which is a basic fact about scalability. When you are dealing with small samples, you care much more about the efficiency of your individual operations. Which is relatively easy to benchmark. When you deal with large samples, you care about the scaling pattern. A very cheap operation that is at a spot which scales poorly will eventually be a bottleneck. Understanding the latter kind of problem is fairly hard for most people, and problems of this nature constantly tend to surprise people who didn't factor it in in a simple extrapolation.

(Important note: scaling bottlenecks don't just happen in code. If you spend most of your life in meetings, well you've just seen what a scaling bottleneck in an organization of humans looks like!)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://350106]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (7)
As of 2016-09-30 03:01 GMT
Find Nodes?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:

    Results (562 votes). Check out past polls.