------ art_12927_10684302.1202254026883 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On Feb 5, 2008 3:14 PM, James Gray <james / grayproductions.net> wrote: > On Feb 5, 2008, at 1:00 PM, Eric Mahurin wrote: > > > Has anyone been able to benchmark the ghostwheel json parser? > > Sorry about that. GhostWheel doesn't need to instantiate the parser > before calling parse(). Drop the .new in your setup and it will work. > > I figured that part out, but there were some significant bugs in the ghostwheel grammar spec: * was using ";" instead of "," between key:value pairs * \b was converted to \n * not handling number with exponent and fractional part I fixed those, but it still has a bug where it sometimes spits out arrays where an object/hash should be. I'm just skipped the self-checking in my benchmark to get some results. I added a new column to the results to show how much coding is needed for the parser. I stripped out comments and leading whitespace and measured gzip size. For the parser generators, I only measured the parser spec (i.e. treetop file) size. Here are the results: ch/s F E gzip author/gem ------- - - ---- ---------- - 5 0 545 Pawel Radecki (RE, recursive descent) 1226 3 2 1074 James Edward Gray II (peggy) 3214 5 1 683 Justin Ethier (RE lexer, ruby eval, fixes) 4054 0 0 608 Eric Mahurin (Grammar0, no lexer, no code-gen) 4076 6 2 588 ghostwheel (ghostwheel, fixes) 4078 2 0 706 Eric I (Treetop, unicode broken) 6534 2 0 631 Steve (Treetop, mismatches in benchmark) 8313 1 1 545 Clifford Heath (Treetop, removed handling of "\/") 17320 0 0 842 Alexander Stedile (RE, recursive descent) 54586 0 0 723 Eric Mahurin (Grammar, no lexer, v0.5) 137989 2 1 660 Paolo Bonzini (RE, recursive descent) 166041 2 1 445 Thomas Link (RE lexer, ruby eval, ruby 1.9 results) 186042 5 0 685 James Edward Gray II (RE, recursive descent) 220289 1 0 - json 223486 0 0 653 Eric Mahurin (Grammar, no lexer, unreleased) 224823 6 0 - fjson (uses C extensions) 287292 5 0 606 James Edward Gray II (RE, recursive, Eric optimized) 333368 3 0 405 Thomas Link & Paolo Bonzini (RE + eval) 388670 0 0 827 Eric Mahurin (recursive descent) 553081 4 9 653 Eric Mahurin (Grammar, no lexer, unreleased, ruby2cext) 1522250 0 0 - json (w/ C extensions) Notice that there isn't much advantage to use a parser generator in this case. Since JSON is relatively simple, you don't save much (or any) coding by using a parser generator. ------ art_12927_10684302.1202254026883--