PetitParser for Dart Reloaded

A year has passed since my last post about PetitParser. Several people have asked me to give an update.

Performance

First, let’s talk about performance. I run the same benchmark using the same machine as last time, however I updated the Smalltalk, Java and Dart VM to the most recent versions. These are the results:

  1. Java: 1119ms (OpenJDK 64-Bit 1.8)
  2. Dart: 3365ms (Dart VM 0.5.7.2_r22611)
  3. Smalltalk: 3854ms (Pharo 1.3 on Cog)

Java is still a clear winner, even if it is significantly slower than last time. This probably has to do with the use of a different VM brand and should be taken with a grain of salt. Dart has improved massively: The Dart VM is almost twice as fast as a year ago and surpassed the Smalltalk VM. Also the Smalltalk Cog VM has improved slightly.

Grammar definition

In Dart the definition of the identifier parser is similar:

 var parser = letter().seq(letter().or(digit()).star());

can alternatively be written using overloaded operators as

 var parser = letter() & (letter() | digit()).star();
Posted by Lukas Renggli with tags petitparser, dart link