Permalink
Browse files

Speed up binary ops by moving from map to switch/case

benchmark                           old ns/op     new ns/op     delta
BenchmarkComparisons-8              975           739           -24.21%
BenchmarkBinaryOperators-8          1294          993           -23.26%
BenchmarkConcatSmall-8              1312          1120          -14.63%
BenchmarkArrayOperations-8          2542          2350          -7.55%
BenchmarkRecursiveFunc-8            64319         60507         -5.93%
BenchmarkBuiltinSub-8               16213         15305         -5.60%
BenchmarkForInLoop-8                3886          4092          +5.30%
BenchmarkBuiltinLength-8            3201          3040          -5.03%
BenchmarkBuiltinSubAmpersand-8      16536         15731         -4.87%
BenchmarkFuncCall-8                 13044         13710         +5.11%
BenchmarkBuiltinSprintf-8           16713         15972         -4.43%
BenchmarkBuiltinGsubAmpersand-8     20253         19415         -4.14%
BenchmarkSimpleBuiltins-8           7101          6828          -3.84%
BenchmarkBuiltinSubstr-8            4795          4651          -3.00%
BenchmarkBuiltinSplitSpace-8        122964        119347        -2.94%
BenchmarkBuiltinGsub-8              18760         18242         -2.76%
BenchmarkLocalVars-8                3038          2959          -2.60%
BenchmarkBuiltinSplitRegex-8        156620        152834        -2.42%
BenchmarkBuiltinMatch-8             5069          4964          -2.07%
BenchmarkGetField-8                 596           585           -1.85%
BenchmarkForLoop-8                  15978         15706         -1.70%
BenchmarkGlobalVars-8               2588          2628          +1.55%
BenchmarkConcatLarge-8              7112357       7203914       +1.29%
BenchmarkSimplePattern-8            245           248           +1.22%
BenchmarkSetField-8                 1614          1599          -0.93%
BenchmarkIncrDecr-8                 2461          2441          -0.81%
BenchmarkIfStatement-8              1202          1194          -0.67%
BenchmarkCondExpr-8                 868           867           -0.12%
BenchmarkBuiltinIndex-8             4664          4659          -0.11%
BenchmarkRegexMatch-8               2224          2224          +0.00%
  • Loading branch information...
benhoyt committed Aug 30, 2018
1 parent 99d4168 commit ad8ff0e5f6cc89fdd480099614187ee23b20a8c9
Showing with 284 additions and 285 deletions.
  1. +210 −210 benchmarks.txt
  2. +0 −1 goawk.go
  3. +74 −74 interp/interp.go
Oops, something went wrong.

0 comments on commit ad8ff0e

Please sign in to comment.