Any suggestions?

Kragen Sitaker kragen at dnaco.net
Fri Sep 22 20:23:35 EDT 2000


In article <8qgnjp$183$1 at panix6.panix.com>, Aahz Maruch <aahz at panix.com> wrote:
>Every language has its efficient coding tricks; the neat thing about
>Python is that once you've gotten a decent handle on its tricks, you can
>concentrate on algorithmic improvements -- even if your C code is a
>hundred times faster than the Python code, you'll be unhappy as soon as
>you hit non-trivial inputs if your C code is O(N^2) and your Python code
>is O(NlogN).

Your point is a good one, for sure, but constant factors are still
important in lots of cases.

Assuming that 'log' is to base 2, they won't even be the same speed
until N > 1000, and the slowness may not be bad enough to make you
unhappy until N > 10000.  Whether this size of input is 'trivial' or
not is context-dependent; it may be a non-trivial number of payroll
records or remote hosts, or a trivial number of bytes in a file or
three-dimensional vectors.
-- 
<kragen at pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Perilous to all of us are the devices of an art deeper than we ourselves
possess.
                -- Gandalf the Grey [J.R.R. Tolkien, "Lord of the Rings"]



More information about the Python-list mailing list