View Single Post
Old 03 August 2015, 14:26   #216
Mrs Beanbag
Glastonbridge Software
Mrs Beanbag's Avatar
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,202
i had to go for a long walk before writing this reply.

it is as if everything i have said about algorithmic time complexity has just gone down a black hole. i said that a lot of problems in modern code are caused by programmers not understanding it, well it seems that old-timer asm coders don't understand it either. They know a hash map is "fast" but that's about it.

Maybe hand-coded asm (by an expert) is 4 times faster (i remember reading the figure 3 times faster on average, elsewhere) but let's just say 10 times for simplicity. In any case, it is a more-or-less constant factor for any given compiler.

The point is, you could write the most efficient bubble sort ever in hand-coded asm, but even a crudely implemented quick sort written in AMOS Basic would still outperform it given a sufficiently large input. The choice of algorithm makes far more difference than the choice of language for all but fairly trivial operations. Asm might be ten times faster than any given language, but an O(n log n) algorithm might be hundreds, thousands, even millions of times faster than a naive O(n^2) algorithm, for the size of data sets you are dealing with.

Well then you would say, if you wrote the quick sort in asm it would be ever faster still. And you'd be right. But the user really doesn't care if he gets his result in a tenth of a second or a hundredth of a second, but he sure as hell doesn't want to have to wait ten minutes.

Of course we care about speed, but performance isn't the only consideration. There are other priorities too, such as development time, portability, maintainability, and of course being able to hire people who can actually do it.
Mrs Beanbag is offline  
Page generated in 0.05193 seconds with 9 queries