I could use some help making this Python code run faster using only Python code.

George Sakkis george.sakkis at gmail.com
Fri Sep 21 17:49:59 EDT 2007


On Sep 21, 1:00 pm, Python Maniac <raych... at hotmail.com> wrote:

> My best runtime with Ruby using the same machine and OS was 67.797
> secs which is 29.8x slower than the fastest Python runtime.  This
> makes Ruby almost as slow as Python was made faster.  The irony with
> Ruby was that the use of a hash in Ruby actually made the Ruby code
> run slower than when a hash was not used.

I'm not familiar with Ruby but chances are that if you post at
c.l.ruby you'll get some good suggestions on how to speed up your ruby
code too (although the difference may not be so dramatic).

> Now I think I will code this little scrambler using nothing but the D
> Language just to see whether there is any benefit in using D over
> Python for this sort of problem.

And then you'll do it in assembly to see how much do you gain compared
to D ? If this is not just for learning purposes, perhaps you should
be thinking it the other way around: how fast is fast enough ?
Optimizing just for the sake of optimization, without a specific
performance goal in mind, is not the most productive way to do things
(again, leaving learning motivations aside).

George




More information about the Python-list mailing list