[Pyrex] Pyrex v Psyco

John Machin sjmachin at lexicon.net
Mon Jun 19 12:34:44 UTC 2006


On 19/06/2006 8:59 AM, Philip Smith wrote:
> Hi
>  
> First of all thanks to Greg for Pyrex (which I have come to very 
> recently and which will certainly make wrapping libraries easier)
>  
> I've been looking for an alternative to Psyco for distributing Python 
> apps to other platforms than Win32 - however (while not being in general 
> a 'speed' junkie) I don't want to sacrifice performance.
>  
> I've been trying Pyrex out on a small text search programme which uses 
> the Boyer-Moore algorithm and which I have adapted to search for all 
> occurrences of a string in the given text.
>  
> With algorithmic improvements I managed something like a 10 fold 
> increase in speed performance and Psyco gives me another 10 fold 
> increase.  I've read all the tips and tricks re: Pyrex I can find and 
> tried to implement them but I can't seem to replicate the performance 
> enhancement over Psyco which the Pyrex test suite demonstrates - in fact 
> Psyco wins hands down every time.
>  
> Am I (as a newcomer) doing soething obviously wrong or is there 
> something about this code that means one wouldn't expect particularly 
> fast execution???
>  

Here's a possibly more useful response than my earlier one, a real live 
working example:

|>> import strdemo as sd
|>> sd.quick_search.__doc__
'Return a list of the offsets at which <pattern> is found in <text>.'
|>> sd.quick_search('foo', ('fo'* 10 + 'o') * 3)
[18, 39, 60]
|>>

See attached file.
HTH,
John
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: strdemo.pyx
Url: http://lists.copyleft.no/pipermail/pyrex/attachments/20060619/980a1c57/attachment.ksh 


More information about the Pyrex mailing list