3 ms·
Please excuse the tone of this post. I have spent a lot of time thinking about potential performance issues, and rationalising my choices. I'm a ACM ICPC (prog
by gridspy 17y ago
Please excuse the tone of this post. I have spent a lot of time thinking about potential performance issues, and rationalising my choices.
I'm a ACM ICPC (programming contest) finalist, and have competed in the Google Codejam, so I know about big-oh.
Anyway, who implements a sorting algorithm in pure Python? I use the builtin sort() function, which is implemented in C (making callbacks into python for comparisons for some types). It uses TimSort - an approach designed to minimise the number of comparisons.
http://svn.python.org/projects/python/trunk/Objects/listsort.txt http://svn.python.org/projects/python/trunk/Objects/listsort...
I thought you were going to point out that I should ensure that my system is modular (stateless, partitioned, etc) and I can spread the load across several machines - I can.
You are right that I could make a screaming fast bubble sort and still end up with major issues. Fortunately I already have had that epiphany while solving ACM practice problems.
I appreciate your advice, there are far too many who haven't yet understood it.
- strlen 17y agoSorry if I sounded condescending. I didn't know the specifics of your system (is it mostly on the server side, embedded, etc...?) so I couldn't give you any specific advise. The sort example was merely a metaphor for design for scalability vs. optimization for performance. Perhaps better examples would have been dividing the server side portion of your application into asynchronously invoked services is design for scalability. Rewriting some of these services in C or OCaml, switching from JSON to Protocol Buffers, switching from an HTTP server and a layer 7 load balancer to a custom non-blocking server and ZooKeeper (for cluster membership) are optimizations for performance/stability/cost.