markhibberd/argonaut — pull request #47 by seanparsons (2013-05-11 17:45:47+00:00)
Title: Crazy uprated parser!

So I just hacked wildly at the parser flattening the tokenisation and then parsing steps together which lent itself towards a whole bunch of optimisations which so far appear to have yielded somewhere between a 20% and 30% increase in performance.

Before:
```
[info] 0% Scenario{vm=java, trial=0, benchmark=example} 52404.09 ns; σ=473.36 ns @ 3 trials
[info] 6% Scenario{vm=java, trial=0, benchmark=integers} 117656.72 ns; σ=3716.20 ns @ 10 trials
[info] 13% Scenario{vm=java, trial=0, benchmark=jp10} 205910.76 ns; σ=1701.66 ns @ 4 trials
[info] 19% Scenario{vm=java, trial=0, benchmark=jp100} 1213895.56 ns; σ=30091.19 ns @ 10 trials
[info] 25% Scenario{vm=java, trial=0, benchmark=jp50} 651599.99 ns; σ=3248.46 ns @ 3 trials
[info] 31% Scenario{vm=java, trial=0, benchmark=numbers} 394505.17 ns; σ=1586.72 ns @ 3 trials
[info] 38% Scenario{vm=java, trial=0, benchmark=twitter1} 15376.50 ns; σ=127.52 ns @ 3 trials
[info] 44% Scenario{vm=java, trial=0, benchmark=twitter10} 94967.36 ns; σ=1259.69 ns @ 10 trials
[info] 50% Scenario{vm=java, trial=0, benchmark=twitter100} 909659.42 ns; σ=1816.41 ns @ 3 trials
[info] 56% Scenario{vm=java, trial=0, benchmark=twitter20} 185054.96 ns; σ=2704.57 ns @ 10 trials
[info] 63% Scenario{vm=java, trial=0, benchmark=twitter50} 468922.19 ns; σ=3149.32 ns @ 3 trials
[info] 69% Scenario{vm=java, trial=0, benchmark=apachebuilds} 1785306.93 ns; σ=8764.64 ns @ 3 trials
[info] 75% Scenario{vm=java, trial=0, benchmark=smallnospaces} 2841.55 ns; σ=88.72 ns @ 10 trials
[info] 81% Scenario{vm=java, trial=0, benchmark=smallspaces4} 3640.20 ns; σ=112.23 ns @ 10 trials
[info] 88% Scenario{vm=java, trial=0, benchmark=nospaces} 933662.50 ns; σ=18534.95 ns @ 10 trials
[info] 94% Scenario{vm=java, trial=0, benchmark=spaces4} 1030284.07 ns; σ=23362.06 ns @ 10 trials
[info]
[info] benchmark us linear runtime
[info] example 52.40 =
[info] integers 117.66 =
[info] jp10 205.91 ===
[info] jp100 1213.90 ====================
[info] jp50 651.60 ==========
[info] numbers 394.51 ======
[info] twitter1 15.38 =
[info] twitter10 94.97 =
[info] twitter100 909.66 ===============
[info] twitter20 185.05 ===
[info] twitter50 468.92 =======
[info] apachebuilds 1785.31 ==============================
[info] smallnospaces 2.84 =
[info] smallspaces4 3.64 =
[info] nospaces 933.66 ===============
[info] spaces4 1030.28 =================
```

After:
```
[info] 0% Scenario{vm=java, trial=0, benchmark=example} 34939.92 ns; σ=54.90 ns @ 3 trials
[info] 6% Scenario{vm=java, trial=0, benchmark=integers} 92157.36 ns; σ=679.40 ns @ 3 trials
[info] 13% Scenario{vm=java, trial=0, benchmark=jp10} 175541.39 ns; σ=1638.02 ns @ 3 trials
[info] 19% Scenario{vm=java, trial=0, benchmark=jp100} 994062.97 ns; σ=5780.44 ns @ 3 trials
[info] 25% Scenario{vm=java, trial=0, benchmark=jp50} 528494.61 ns; σ=3179.39 ns @ 3 trials
[info] 31% Scenario{vm=java, trial=0, benchmark=numbers} 326569.23 ns; σ=1986.34 ns @ 3 trials
[info] 38% Scenario{vm=java, trial=0, benchmark=twitter1} 12346.10 ns; σ=108.70 ns @ 3 trials
[info] 44% Scenario{vm=java, trial=0, benchmark=twitter10} 78064.18 ns; σ=3782.72 ns @ 10 trials
[info] 50% Scenario{vm=java, trial=0, benchmark=twitter100} 751516.37 ns; σ=17587.15 ns @ 10 trials
[info] 56% Scenario{vm=java, trial=0, benchmark=twitter20} 147598.83 ns; σ=3311.68 ns @ 10 trials
[info] 63% Scenario{vm=java, trial=0, benchmark=twitter50} 369599.68 ns; σ=3215.08 ns @ 4 trials
[info] 69% Scenario{vm=java, trial=0, benchmark=apachebuilds} 1087021.31 ns; σ=19110.83 ns @ 10 trials
[info] 75% Scenario{vm=java, trial=0, benchmark=smallnospaces} 2756.44 ns; σ=109.31 ns @ 10 trials
[info] 81% Scenario{vm=java, trial=0, benchmark=smallspaces4} 3599.78 ns; σ=83.90 ns @ 10 trials
[info] 88% Scenario{vm=java, trial=0, benchmark=nospaces} 955705.56 ns; σ=45601.48 ns @ 10 trials
[info] 94% Scenario{vm=java, trial=0, benchmark=spaces4} 1033987.76 ns; σ=18855.62 ns @ 10 trials
[info]
[info] benchmark us linear runtime
[info] example 34.94 =
[info] integers 92.16 ==
[info] jp10 175.54 ====
[info] jp100 994.06 ===========================
[info] jp50 528.49 ==============
[info] numbers 326.57 =========
[info] twitter1 12.35 =
[info] twitter10 78.06 ==
[info] twitter100 751.52 ====================
[info] twitter20 147.60 ====
[info] twitter50 369.60 ==========
[info] apachebuilds 1087.02 ==============================
[info] smallnospaces 2.76 =
[info] smallspaces4 3.60 =
[info] nospaces 955.71 ==========================
[info] spaces4 1033.99 ============================
```