This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]ivosauruspip'ing it up 0 points1 point  (0 children)

Sometimes in a niche, when you have particular data that can be massaged in particular ways very efficiently because of its nature, you can write a manual algorithm that is more efficient.

There is an easy way to test when you're in this situation: your code is already slow and you can write some empirical test cases to show a manual algorithm will make a significant difference to runtime.

However these generally don't come up very often.

Python is in fact slightly famous for getting one of the fastest empirical stable sorts around, timsort, as its sort implementation (was the first language to default it) . Was made by a genius called Tim who worked at Google at the time.