Hi Stefan,

>> As I plan to use my parser in a real application, but cannot do so if it is
>> too slow,  I took a look at the code by could not find anything that might
>> explain the long execution time.
>>
>> Therefore I would be glad if someone could help me find this bottleneck.

The csv library uses a hand-written parser; such a parser (suitably 
constructed) will always be faster than a parser generated using a 
general purpose parser generation lib. (such as parslet, treetop, ...)

I've taken the liberty of incorporating your csv parser in my benchmark 
suite. Here are the results of comparing treetop with parslet on that 
parser:

CSV parsing
  size       parslet   treetop
        253:   0.020     0.010
       5293:   0.410     0.120
      10207:   0.910     0.310
      15247:   1.430     0.430
      20161:   1.940     0.610
      25201:   2.420     0.900
      30115:   3.180     1.060
      35155:   3.900     1.100
      40069:   4.130     1.360
      45109:   5.080     1.680
      50023:   5.840     1.900

Nothing new here. I would like parslet to perform the same as treetop - 
I am working on that. But I will never achieve performance of the csv 
stdlib.

I guess the reason for this is that parslet&treetop do a lot more work 
than csv does: Overhead ;)

regards,
kaspar


Reply via email to