Skip to content

6.0.0

Compare
Choose a tag to compare
@bmf-san bmf-san released this 13 Nov 07:58
· 75 commits to master since this release
d4f43eb

Description

  • Mainly improved performance
  • End of support for go1.15 as a breaking change

Benchmark comparison between 5.4.0 and 6.0.0

Benchmark

5.4.0

goos: darwin
goarch: amd64
pkg: github.com/bmf-san/goblin
cpu: VirtualApple @ 2.50GHz
BenchmarkStatic1-8      	14049327	        82.37 ns/op	     128 B/op	       4 allocs/op
BenchmarkStatic5-8      	 6234420	       195.8 ns/op	     384 B/op	       6 allocs/op
BenchmarkStatic10-8     	 3591472	       335.7 ns/op	     720 B/op	       7 allocs/op
BenchmarkWildCard1-8    	 4217578	       279.7 ns/op	     468 B/op	       9 allocs/op
BenchmarkWildCard5-8    	 1445695	       840.7 ns/op	    1049 B/op	      23 allocs/op
BenchmarkWildCard10-8   	  831021	      1458 ns/op	    1737 B/op	      35 allocs/op
BenchmarkRegexp1-8      	 4226604	       282.7 ns/op	     469 B/op	       9 allocs/op
BenchmarkRegexp5-8      	 1428550	       826.7 ns/op	    1048 B/op	      23 allocs/op
BenchmarkRegexp10-8     	  885196	      1459 ns/op	    1736 B/op	      35 allocs/op
PASS
ok  	github.com/bmf-san/goblin	14.504s

6.0.0

goos: darwin
goarch: amd64
pkg: github.com/bmf-san/goblin
cpu: VirtualApple @ 2.50GHz
BenchmarkStatic1-8      	37823017	        30.31 ns/op	      32 B/op	       1 allocs/op
BenchmarkStatic5-8      	16509595	        72.04 ns/op	      96 B/op	       1 allocs/op
BenchmarkStatic10-8     	 9619684	       127.3 ns/op	     176 B/op	       1 allocs/op
BenchmarkWildCard1-8    	 4680534	       248.2 ns/op	     395 B/op	       6 allocs/op
BenchmarkWildCard5-8    	 1599696	       744.7 ns/op	     961 B/op	      13 allocs/op
BenchmarkWildCard10-8   	  910838	      1340 ns/op	    1611 B/op	      19 allocs/op
BenchmarkRegexp1-8      	 5017092	       238.7 ns/op	     395 B/op	       6 allocs/op
BenchmarkRegexp5-8      	 1620951	       744.3 ns/op	     956 B/op	      13 allocs/op
BenchmarkRegexp10-8     	  989516	      1334 ns/op	    1614 B/op	      19 allocs/op
PASS
ok  	github.com/bmf-san/goblin	14.654s

Benchstat

name          old time/op    new time/op    delta
Static1-8       82.4ns ± 0%    30.3ns ± 0%   ~     (p=1.000 n=1+1)
Static5-8        196ns ± 0%      72ns ± 0%   ~     (p=1.000 n=1+1)
Static10-8       336ns ± 0%     127ns ± 0%   ~     (p=1.000 n=1+1)
WildCard1-8      280ns ± 0%     248ns ± 0%   ~     (p=1.000 n=1+1)
WildCard5-8      841ns ± 0%     745ns ± 0%   ~     (p=1.000 n=1+1)
WildCard10-8    1.46µs ± 0%    1.34µs ± 0%   ~     (p=1.000 n=1+1)
Regexp1-8        283ns ± 0%     239ns ± 0%   ~     (p=1.000 n=1+1)
Regexp5-8        827ns ± 0%     744ns ± 0%   ~     (p=1.000 n=1+1)
Regexp10-8      1.46µs ± 0%    1.33µs ± 0%   ~     (p=1.000 n=1+1)

name          old alloc/op   new alloc/op   delta
Static1-8         128B ± 0%       32B ± 0%   ~     (p=1.000 n=1+1)
Static5-8         384B ± 0%       96B ± 0%   ~     (p=1.000 n=1+1)
Static10-8        720B ± 0%      176B ± 0%   ~     (p=1.000 n=1+1)
WildCard1-8       468B ± 0%      395B ± 0%   ~     (p=1.000 n=1+1)
WildCard5-8     1.05kB ± 0%    0.96kB ± 0%   ~     (p=1.000 n=1+1)
WildCard10-8    1.74kB ± 0%    1.61kB ± 0%   ~     (p=1.000 n=1+1)
Regexp1-8         469B ± 0%      395B ± 0%   ~     (p=1.000 n=1+1)
Regexp5-8       1.05kB ± 0%    0.96kB ± 0%   ~     (p=1.000 n=1+1)
Regexp10-8      1.74kB ± 0%    1.61kB ± 0%   ~     (p=1.000 n=1+1)

name          old allocs/op  new allocs/op  delta
Static1-8         4.00 ± 0%      1.00 ± 0%   ~     (p=1.000 n=1+1)
Static5-8         6.00 ± 0%      1.00 ± 0%   ~     (p=1.000 n=1+1)
Static10-8        7.00 ± 0%      1.00 ± 0%   ~     (p=1.000 n=1+1)
WildCard1-8       9.00 ± 0%      6.00 ± 0%   ~     (p=1.000 n=1+1)
WildCard5-8       23.0 ± 0%      13.0 ± 0%   ~     (p=1.000 n=1+1)
WildCard10-8      35.0 ± 0%      19.0 ± 0%   ~     (p=1.000 n=1+1)
Regexp1-8         9.00 ± 0%      6.00 ± 0%   ~     (p=1.000 n=1+1)
Regexp5-8         23.0 ± 0%      13.0 ± 0%   ~     (p=1.000 n=1+1)
Regexp10-8        35.0 ± 0%      19.0 ± 0%   ~     (p=1.000 n=1+1)

What's Changed

  • Reduce the memory allocation by refactoring explodePath method by @bmf-san in #68
  • Reduce the memory allocation by refactoring newResult method by @bmf-san in #69
  • Lint bench_test.go by @bmf-san in #71
  • Add some go lint tools by @bmf-san in #72
  • [update] stopped using pointers for params by @bmf-san in #73
  • Refactoring router receiver by @bmf-san in #74

Full Changelog: 5.4.0...6.0.0