speed
David M. Cooke
cookedm+news at physics.mcmaster.ca
Sat Aug 21 22:50:26 EDT 2004
At some point, Ayose <ayose.cazorla at hispalinux.es> wrote:
> On Thu, Aug 19, 2004 at 03:37:26PM +0200, Peter Kleiweg wrote:
>>
>> I implemented a lexer in Pylly and compared it to the version I
>> had written in Flex. Processing 219062 lines took 0.9 seconds in
>> C (from Flex), and 5 minutes 54 second in Python (from Pylly), a
>> ratio of 393 to 1.
>>
>> Is this normal for Python, or does Flex produce better parsers
>> than Pylly? I have been looking at the code produced by Flex to
>> see if I could translate it to Python automaticly. But it has a
>> lot of goto statements, and I haven't figured out how to
>> translate those to Python efficiently.
>...
> But, IMHO, if you has to process very big files, don't do it with
> python. Instead, write a simple C-module, which uses your Flex parser
> and creates python objects with that information. It should be trivial
> if you have experience with the C API. :-)
Or have a look at FlexModule at
http://www.cs.utexas.edu/users/mcguire/software/fbmodule/
which makes it really simple without experience with the C API.
--
|>|\/|<
/--------------------------------------------------------------------------\
|David M. Cooke
|cookedm(at)physics(dot)mcmaster(dot)ca
More information about the Python-list
mailing list