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

2007-09-23 Thread Matt McCredie
Yes, Digital Mars D is what I was referring to and yes I know D is not as efficient as C++. If I knew of a good C++ compiler that is not from Microsoft that works natively with Windows I would be happy to consider using it. I've had good luck with MinGW (gcc compiled for windows).

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

2007-09-22 Thread Marc 'BlackJack' Rintsch
On Fri, 21 Sep 2007 16:25:20 -0700, Python Maniac wrote: On Sep 21, 3:02 pm, Matt McCredie [EMAIL PROTECTED] wrote: Isn't D compiled to machine code? I would expect it to win hands down. That is, unless it is horribly unoptimized. Well D code is compiled into machine code that runs via a

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

2007-09-22 Thread Python Maniac
On Sep 21, 11:39 pm, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Fri, 21 Sep 2007 16:25:20 -0700, Python Maniac wrote: On Sep 21, 3:02 pm, Matt McCredie [EMAIL PROTECTED] wrote: Isn't D compiled to machine code? I would expect it to win hands down. That is, unless it is horribly

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

2007-09-22 Thread Python Maniac
On Sep 21, 12:56 am, Duncan Booth [EMAIL PROTECTED] wrote: George Sakkis [EMAIL PROTECTED] wrote: It has to do with the input string length; try multiplying it by 10 or 100. Below is a more complete benchmark; for largish strings, the imap version is the fastest among those using the

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

2007-09-22 Thread Marc 'BlackJack' Rintsch
On Sat, 22 Sep 2007 13:00:27 -0700, Python Maniac wrote: On Sep 21, 11:39 pm, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Fri, 21 Sep 2007 16:25:20 -0700, Python Maniac wrote: Well D code is compiled into machine code that runs via a VM. About which D are we talking here? Not

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

2007-09-21 Thread George Sakkis
On Sep 20, 7:13 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On Sep 20, 5:46 pm, Paul Hankin [EMAIL PROTECTED] wrote: On Sep 20, 10:59 pm, Python Maniac [EMAIL PROTECTED] wrote: I am new to Python however I would like some feedback from those who know more about Python than I do at

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

2007-09-21 Thread Duncan Booth
George Sakkis [EMAIL PROTECTED] wrote: It has to do with the input string length; try multiplying it by 10 or 100. Below is a more complete benchmark; for largish strings, the imap version is the fastest among those using the original algorithm. Of course using a lookup table as Diez showed

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

2007-09-21 Thread Python Maniac
On Sep 21, 12:56 am, Duncan Booth [EMAIL PROTECTED] wrote: George Sakkis [EMAIL PROTECTED] wrote: It has to do with the input string length; try multiplying it by 10 or 100. Below is a more complete benchmark; for largish strings, the imap version is the fastest among those using the

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

2007-09-21 Thread George Sakkis
On Sep 21, 1:00 pm, Python Maniac [EMAIL PROTECTED] 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

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

2007-09-21 Thread Matt McCredie
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. Isn't D compiled to machine code? I would expect it to win hands down. That is, unless it is horribly unoptimized. Matt --

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

2007-09-21 Thread Python Maniac
On Sep 21, 3:02 pm, Matt McCredie [EMAIL PROTECTED] wrote: 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. Isn't D compiled to machine code? I would expect it to win

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

2007-09-21 Thread Matt McCredie
It would be nice if Python could be made to automatically detect the LC and string translation patterns used by the unoptimized Python code and make them into optimized Python code on the fly at runtime. I am more than a little amazed nobody has chosen to build a JIT (Just In- Time compiler)

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

2007-09-21 Thread Python Maniac
On Sep 21, 4:48 pm, Matt McCredie [EMAIL PROTECTED] wrote: It would be nice if Python could be made to automatically detect the LC and string translation patterns used by the unoptimized Python code and make them into optimized Python code on the fly at runtime. I am more than a little

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

2007-09-20 Thread Python Maniac
I am new to Python however I would like some feedback from those who know more about Python than I do at this time. def scrambleLine(line): s = '' for c in line: s += chr(ord(c) | 0x80) return s def descrambleLine(line): s = '' for c in line: s += chr(ord(c)

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

2007-09-20 Thread Paul Hankin
On Sep 20, 10:59 pm, Python Maniac [EMAIL PROTECTED] wrote: I am new to Python however I would like some feedback from those who know more about Python than I do at this time. def scrambleLine(line): s = '' for c in line: s += chr(ord(c) | 0x80) return s def

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

2007-09-20 Thread Matt McCredie
On 9/20/07, Python Maniac [EMAIL PROTECTED] wrote: I am new to Python however I would like some feedback from those who know more about Python than I do at this time. Well, you could save some time by not applying the scramble one line at a time (that is if you don't mind losing the line

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

2007-09-20 Thread Diez B. Roggisch
Python Maniac schrieb: I am new to Python however I would like some feedback from those who know more about Python than I do at this time. def scrambleLine(line): s = '' for c in line: s += chr(ord(c) | 0x80) return s def descrambleLine(line): s = '' for c

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

2007-09-20 Thread Tim Williams
On 21/09/2007, Tim Williams [EMAIL PROTECTED] wrote: On 20/09/2007, Python Maniac [EMAIL PROTECTED] wrote: I am new to Python however I would like some feedback from those who know more about Python than I do at this time. def scrambleLine(line): s = '' for c in line: s

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

2007-09-20 Thread Michael Spencer
Python Maniac wrote: I am new to Python however I would like some feedback from those who know more about Python than I do at this time. def scrambleLine(line): s = '' for c in line: s += chr(ord(c) | 0x80) return s def descrambleLine(line): s = '' for c

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

2007-09-20 Thread Python Maniac
On Sep 20, 3:57 pm, Matt McCredie [EMAIL PROTECTED] wrote: On 9/20/07, Python Maniac [EMAIL PROTECTED] wrote: I am new to Python however I would like some feedback from those who know more about Python than I do at this time. Well, you could save some time by not applying the scramble one

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

2007-09-20 Thread [EMAIL PROTECTED]
On Sep 20, 5:46 pm, Paul Hankin [EMAIL PROTECTED] wrote: On Sep 20, 10:59 pm, Python Maniac [EMAIL PROTECTED] wrote: I am new to Python however I would like some feedback from those who know more about Python than I do at this time. def scrambleLine(line): s = '' for c in

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

2007-09-20 Thread Tim Williams
On 20/09/2007, Python Maniac [EMAIL PROTECTED] wrote: I am new to Python however I would like some feedback from those who know more about Python than I do at this time. def scrambleLine(line): s = '' for c in line: s += chr(ord(c) | 0x80) return s def

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

2007-09-20 Thread Paul Rubin
Python Maniac [EMAIL PROTECTED] writes: I am new to Python however I would like some feedback from those who know more about Python than I do at this time. Use the array module and do 32-bit or 64-bit operations with it. See http://nightsong.com/phr/crypto/p3.py for a more serious encryption

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

2007-09-20 Thread Ian Clark
[EMAIL PROTECTED] wrote: On Sep 20, 5:46 pm, Paul Hankin [EMAIL PROTECTED] wrote: On Sep 20, 10:59 pm, Python Maniac [EMAIL PROTECTED] wrote: I am new to Python however I would like some feedback from those who know more about Python than I do at this time. def scrambleLine(line): s =

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

2007-09-20 Thread Istvan Albert
On Sep 20, 7:13 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: How come it's not? Then I noticed you don't have brackets in the join statement. So I tried without them and got If memory serves me right newer versions of python will recognize and optimize string concatenation via the +=