What psyco is goot at [Was: Rookie Speaks]

Tim Churches tchur at optushome.com.au
Thu Jan 8 17:10:58 EST 2004


On Fri, 2004-01-09 at 05:25, Samuel Walters wrote:
> |Thus Spake Jacek Generowicz On the now historical date of Thu, 08 Jan
> 2004 11:43:01 +0100|
> 
> > Samuel Walters <swalters_usenet at yahoo.com> writes:
> > 
> >> If you'd like to see an example of both the psyco and profile modules
> >> in action, let me know and I'll give you some more understandable code
> >> that I once wrote to see what types of things psyco is good at
> >> optimizing.
> > 
> > I think this is generally interesting, and would be curious to see it,
> > if you'd care to share.
> 
> Sure thing.  The functions at the top are naive prime enumeration
> algorithms.  I chose them because they're each of a general "looping"
> nature and I understand the complexity and methods of each of them.  Some
> use lists (and hence linearly indexed) methods and some use dictionary( 
> and hence are has bound). One of them, sieve_list is commented out because 
> it has such dog performance that I decided I wasn't interested in 
> how well it optimized.

Out of curiosity I ran your code, and obtained these results:

Fri Jan  9 08:30:25 2004    primesprof

         23 function calls in 2122.530 CPU seconds

...

Fri Jan  9 08:43:24 2004    psycoprimesprof

         23 function calls in -3537.828 CPU seconds

Does that mean that Armin Rigo has slipped some form of Einsteinian,
relativistic compiler into Psyco? I am reminded of the well-known
limerick:

There once was a lady called Bright,
Who could travel faster than light.
She went out one day,
In a relative way,
And came back the previous night.

-- 

Tim C

PGP/GnuPG Key 1024D/EAF993D0 available from keyservers everywhere
or at http://members.optushome.com.au/tchur/pubkey.asc
Key fingerprint = 8C22 BF76 33BA B3B5 1D5B  EB37 7891 46A9 EAF9 93D0


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 196 bytes
Desc: This is a digitally signed message part
URL: <http://mail.python.org/pipermail/python-list/attachments/20040109/0949bea5/attachment.sig>


More information about the Python-list mailing list