@@ -37,7 +37,7 @@ If you\'re interested in new programming languages, you should definitely take a
3737
3838## Benchmark Results
3939
40- Golang Version: go version go1.13.3 darwin/amd64
40+ Golang Version: go version go1.14 darwin/amd64
4141
4242### base64
4343
@@ -88,10 +88,10 @@ func BenchmarkBase64regex(b *testing.B) {
8888$ go test -bench . -benchmem
8989goos: darwin
9090goarch: amd64
91- BenchmarkBase64decode-8 8689669 139 ns/op 40 B/op 3 allocs/op
92- BenchmarkBase64regex-8 50638 22595 ns/op 21421 B/op 198 allocs/op
91+ BenchmarkBase64decode-8 7254507 156 ns/op 40 B/op 3 allocs/op
92+ BenchmarkBase64regex-8 48475 25091 ns/op 21450 B/op 198 allocs/op
9393PASS
94- ok _/Users/simonwaldherr/git/golang-benchmarks/base64 3.749s
94+ ok _/Users/simonwaldherr/git/golang-benchmarks/base64 2.928s
9595```
9696
9797### between
@@ -183,12 +183,12 @@ func BenchmarkFulltextParse(b *testing.B) {
183183$ go test -bench . -benchmem
184184goos: darwin
185185goarch: amd64
186- BenchmarkNumberRegEx-8 79514 17505 ns/op 16093 B/op 142 allocs/op
187- BenchmarkFulltextRegEx-8 98248 11876 ns/op 11579 B/op 104 allocs/op
188- BenchmarkNumberParse-8 15141446 80.1 ns/op 0 B/op 0 allocs/op
189- BenchmarkFulltextParse-8 1000000 1061 ns/op 32 B/op 2 allocs/op
186+ BenchmarkNumberRegEx-8 65848 16709 ns/op 16119 B/op 142 allocs/op
187+ BenchmarkFulltextRegEx-8 93330 13651 ns/op 11596 B/op 104 allocs/op
188+ BenchmarkNumberParse-8 15222080 79.5 ns/op 0 B/op 0 allocs/op
189+ BenchmarkFulltextParse-8 1000000 1172 ns/op 32 B/op 2 allocs/op
190190PASS
191- ok _/Users/simonwaldherr/git/golang-benchmarks/between 8.005s
191+ ok _/Users/simonwaldherr/git/golang-benchmarks/between 5.338s
192192```
193193
194194### concat
@@ -234,11 +234,11 @@ func BenchmarkConcatBuilder(b *testing.B) {
234234$ go test -bench . -benchmem
235235goos: darwin
236236goarch: amd64
237- BenchmarkConcatString-8 1000000 51987 ns/op 503994 B/op 1 allocs/op
238- BenchmarkConcatBuffer-8 137715688 7.91 ns/op 3 B/op 0 allocs/op
239- BenchmarkConcatBuilder-8 575587425 2.86 ns/op 5 B/op 0 allocs/op
237+ BenchmarkConcatString-8 762847 51951 ns/op 385387 B/op 1 allocs/op
238+ BenchmarkConcatBuffer-8 137992653 8.01 ns/op 3 B/op 0 allocs/op
239+ BenchmarkConcatBuilder-8 360238653 5.07 ns/op 5 B/op 0 allocs/op
240240PASS
241- ok _/Users/simonwaldherr/git/golang-benchmarks/concat 56.321s
241+ ok _/Users/simonwaldherr/git/golang-benchmarks/concat 44.077s
242242```
243243
244244### contains
@@ -388,16 +388,16 @@ func BenchmarkMatchNot(b *testing.B) {
388388$ go test -bench . -benchmem
389389goos: darwin
390390goarch: amd64
391- BenchmarkContains-8 137404404 8.78 ns/op 0 B/op 0 allocs/op
392- BenchmarkContainsNot-8 141748958 8.32 ns/op 0 B/op 0 allocs/op
393- BenchmarkContainsBytes-8 126635754 9.82 ns/op 0 B/op 0 allocs/op
394- BenchmarkContainsBytesNot-8 121881022 9.77 ns/op 0 B/op 0 allocs/op
395- BenchmarkCompileMatch-8 11328054 105 ns/op 0 B/op 0 allocs/op
396- BenchmarkCompileMatchNot-8 23368893 51.0 ns/op 0 B/op 0 allocs/op
397- BenchmarkMatch-8 660074 1627 ns/op 1362 B/op 17 allocs/op
398- BenchmarkMatchNot-8 707730 1537 ns/op 1362 B/op 17 allocs/op
391+ BenchmarkContains-8 115778936 10.1 ns/op 0 B/op 0 allocs/op
392+ BenchmarkContainsNot-8 99892357 12.6 ns/op 0 B/op 0 allocs/op
393+ BenchmarkContainsBytes-8 100000000 11.9 ns/op 0 B/op 0 allocs/op
394+ BenchmarkContainsBytesNot-8 88537238 14.1 ns/op 0 B/op 0 allocs/op
395+ BenchmarkCompileMatch-8 11208225 112 ns/op 0 B/op 0 allocs/op
396+ BenchmarkCompileMatchNot-8 21716254 59.3 ns/op 0 B/op 0 allocs/op
397+ BenchmarkMatch-8 700544 1705 ns/op 1366 B/op 17 allocs/op
398+ BenchmarkMatchNot-8 721296 1627 ns/op 1366 B/op 17 allocs/op
399399PASS
400- ok _/Users/simonwaldherr/git/golang-benchmarks/contains 16.158s
400+ ok _/Users/simonwaldherr/git/golang-benchmarks/contains 11.943s
401401```
402402
403403### foreach
@@ -484,12 +484,12 @@ func BenchmarkRangeSliceKey(b *testing.B) {
484484$ go test -bench . -benchmem
485485goos: darwin
486486goarch: amd64
487- BenchmarkForMap-8 48077392 26.0 ns/op 0 B/op 0 allocs/op
488- BenchmarkRangeMap-8 15363625 74.6 ns/op 0 B/op 0 allocs/op
489- BenchmarkRangeSlice-8 310208679 3.85 ns/op 0 B/op 0 allocs/op
490- BenchmarkRangeSliceKey-8 308933263 3.97 ns/op 0 B/op 0 allocs/op
487+ BenchmarkForMap-8 40688367 29.5 ns/op 0 B/op 0 allocs/op
488+ BenchmarkRangeMap-8 13963262 82.0 ns/op 0 B/op 0 allocs/op
489+ BenchmarkRangeSlice-8 298244845 4.02 ns/op 0 B/op 0 allocs/op
490+ BenchmarkRangeSliceKey-8 283311711 4.16 ns/op 0 B/op 0 allocs/op
491491PASS
492- ok _/Users/simonwaldherr/git/golang-benchmarks/foreach 6.098s
492+ ok _/Users/simonwaldherr/git/golang-benchmarks/foreach 5.934s
493493```
494494
495495### hash
@@ -505,14 +505,18 @@ import (
505505 " crypto/sha1"
506506 " crypto/sha256"
507507 " crypto/sha512"
508- " github.com/jzelinskie/whirlpool"
509- " golang.org/x/crypto/sha3"
510508 " hash"
511509 " hash/adler32"
512510 " hash/crc32"
513511 " hash/fnv"
514512 " math/rand"
515513 " testing"
514+
515+ " github.com/jzelinskie/whirlpool"
516+ " github.com/reusee/mmh3"
517+ " github.com/zeebo/blake3"
518+ " golang.org/x/crypto/blake2b"
519+ " golang.org/x/crypto/sha3"
516520)
517521
518522func benchmarkHashAlgo (b *testing .B , h hash .Hash ) {
@@ -530,6 +534,30 @@ func BenchmarkAdler32(b *testing.B) {
530534 benchmarkHashAlgo (b, adler32.New ())
531535}
532536
537+ func BenchmarkBlake2b256 (b *testing .B ) {
538+ h , err := blake2b.New256 (nil )
539+ if err != nil {
540+ b.Fatal (err)
541+ }
542+ benchmarkHashAlgo (b, h)
543+ }
544+
545+ func BenchmarkBlake2b512 (b *testing .B ) {
546+ h , err := blake2b.New512 (nil )
547+ if err != nil {
548+ b.Fatal (err)
549+ }
550+ benchmarkHashAlgo (b, h)
551+ }
552+
553+ func BenchmarkBlake3256 (b *testing .B ) {
554+ benchmarkHashAlgo (b, blake3.New ())
555+ }
556+
557+ func BenchmarkMMH3 (b *testing .B ) {
558+ benchmarkHashAlgo (b, mmh3.New128 ())
559+ }
560+
533561func BenchmarkCRC32 (b *testing .B ) {
534562 benchmarkHashAlgo (b, crc32.NewIEEE ())
535563}
@@ -571,18 +599,22 @@ func BenchmarkWhirlpool(b *testing.B) {
571599$ go test -bench . -benchmem
572600goos: darwin
573601goarch: amd64
574- BenchmarkAdler32-8 1414144 854 ns/op 8 B/op 1 allocs/op
575- BenchmarkCRC32-8 7998510 152 ns/op 8 B/op 1 allocs/op
576- BenchmarkFnv128-8 229381 5199 ns/op 16 B/op 1 allocs/op
577- BenchmarkMD5-8 369140 3140 ns/op 16 B/op 1 allocs/op
578- BenchmarkSHA1-8 412408 2645 ns/op 32 B/op 1 allocs/op
579- BenchmarkSHA256-8 205897 5854 ns/op 32 B/op 1 allocs/op
580- BenchmarkSHA512-8 272835 4391 ns/op 64 B/op 1 allocs/op
581- BenchmarkSHA3256-8 154688 7670 ns/op 512 B/op 3 allocs/op
582- BenchmarkSHA3512-8 75841 16354 ns/op 576 B/op 3 allocs/op
583- BenchmarkWhirlpool-8 18272 65319 ns/op 64 B/op 1 allocs/op
602+ BenchmarkAdler32-8 1320891 941 ns/op 8 B/op 1 allocs/op
603+ BenchmarkBlake2b256-8 478911 2633 ns/op 32 B/op 1 allocs/op
604+ BenchmarkBlake2b512-8 481056 2445 ns/op 64 B/op 1 allocs/op
605+ BenchmarkBlake3256-8 387159 3669 ns/op 64 B/op 2 allocs/op
606+ BenchmarkMMH3-8 1922512 615 ns/op 16 B/op 1 allocs/op
607+ BenchmarkCRC32-8 7177801 156 ns/op 8 B/op 1 allocs/op
608+ BenchmarkFnv128-8 228894 5273 ns/op 16 B/op 1 allocs/op
609+ BenchmarkMD5-8 359323 3214 ns/op 16 B/op 1 allocs/op
610+ BenchmarkSHA1-8 412834 2653 ns/op 32 B/op 1 allocs/op
611+ BenchmarkSHA256-8 208404 5920 ns/op 32 B/op 1 allocs/op
612+ BenchmarkSHA512-8 304238 4086 ns/op 64 B/op 1 allocs/op
613+ BenchmarkSHA3256-8 163845 7918 ns/op 512 B/op 3 allocs/op
614+ BenchmarkSHA3512-8 93015 13573 ns/op 576 B/op 3 allocs/op
615+ BenchmarkWhirlpool-8 16759 71602 ns/op 64 B/op 1 allocs/op
584616PASS
585- ok _/Users/simonwaldherr/git/golang-benchmarks/hash 14.421s
617+ ok _/Users/simonwaldherr/git/golang-benchmarks/hash 20.138s
586618```
587619
588620### index
@@ -665,10 +697,10 @@ func BenchmarkMapIntKeys(b *testing.B) {
665697$ go test -bench . -benchmem
666698goos: darwin
667699goarch: amd64
668- BenchmarkMapStringKeys-8 10594664 115 ns/op 0 B/op 0 allocs/op
669- BenchmarkMapIntKeys-8 15215637 75.9 ns/op 0 B/op 0 allocs/op
700+ BenchmarkMapStringKeys-8 9294176 123 ns/op 0 B/op 0 allocs/op
701+ BenchmarkMapIntKeys-8 13910860 83.8 ns/op 0 B/op 0 allocs/op
670702PASS
671- ok _/Users/simonwaldherr/git/golang-benchmarks/index 4.415s
703+ ok _/Users/simonwaldherr/git/golang-benchmarks/index 4.156s
672704```
673705
674706### json
@@ -759,10 +791,10 @@ func BenchmarkJsonUnmarshal(b *testing.B) {
759791$ go test -bench . -benchmem
760792goos: darwin
761793goarch: amd64
762- BenchmarkJsonMarshal-8 557385 2157 ns/op 544 B/op 6 allocs/op
763- BenchmarkJsonUnmarshal-8 144934 8452 ns/op 2128 B/op 38 allocs/op
794+ BenchmarkJsonMarshal-8 453858 2461 ns/op 480 B/op 5 allocs/op
795+ BenchmarkJsonUnmarshal-8 115800 10627 ns/op 2128 B/op 38 allocs/op
764796PASS
765- ok _/Users/simonwaldherr/git/golang-benchmarks/json 3.923s
797+ ok _/Users/simonwaldherr/git/golang-benchmarks/json 2.646s
766798```
767799
768800### math
@@ -845,16 +877,16 @@ func BenchmarkMathFloat64(b *testing.B) {
845877$ go test -bench . -benchmem
846878goos: darwin
847879goarch: amd64
848- BenchmarkMathInt8-8 1000000000 0.309 ns/op 0 B/op 0 allocs/op
849- BenchmarkMathInt32-8 1000000000 0.607 ns/op 0 B/op 0 allocs/op
850- BenchmarkMathInt64-8 1000000000 0.312 ns/op 0 B/op 0 allocs/op
851- BenchmarkMathAtomicInt32-8 219145921 5.40 ns/op 0 B/op 0 allocs/op
852- BenchmarkMathAtomicInt64-8 224230356 5.47 ns/op 0 B/op 0 allocs/op
853- BenchmarkMathMutexInt-8 79097586 15.1 ns/op 0 B/op 0 allocs/op
854- BenchmarkMathFloat32-8 1000000000 0.300 ns/op 0 B/op 0 allocs/op
855- BenchmarkMathFloat64-8 1000000000 0.303 ns/op 0 B/op 0 allocs/op
880+ BenchmarkMathInt8-8 1000000000 0.357 ns/op 0 B/op 0 allocs/op
881+ BenchmarkMathInt32-8 1000000000 0.318 ns/op 0 B/op 0 allocs/op
882+ BenchmarkMathInt64-8 1000000000 0.304 ns/op 0 B/op 0 allocs/op
883+ BenchmarkMathAtomicInt32-8 220301023 5.70 ns/op 0 B/op 0 allocs/op
884+ BenchmarkMathAtomicInt64-8 213277671 5.57 ns/op 0 B/op 0 allocs/op
885+ BenchmarkMathMutexInt-8 77317648 18.0 ns/op 0 B/op 0 allocs/op
886+ BenchmarkMathFloat32-8 1000000000 0.630 ns/op 0 B/op 0 allocs/op
887+ BenchmarkMathFloat64-8 1000000000 0.624 ns/op 0 B/op 0 allocs/op
856888PASS
857- ok _/Users/simonwaldherr/git/golang-benchmarks/math 7.156s
889+ ok _/Users/simonwaldherr/git/golang-benchmarks/math 7.624s
858890```
859891
860892### parse
@@ -900,11 +932,11 @@ func BenchmarkParseFloat(b *testing.B) {
900932$ go test -bench . -benchmem
901933goos: darwin
902934goarch: amd64
903- BenchmarkParseBool-8 322785903 3.62 ns/op 0 B/op 0 allocs/op
904- BenchmarkParseInt-8 42614570 27 .8 ns/op 0 B/op 0 allocs/op
905- BenchmarkParseFloat-8 8117090 143 ns/op 0 B/op 0 allocs/op
935+ BenchmarkParseBool-8 552503154 2.02 ns/op 0 B/op 0 allocs/op
936+ BenchmarkParseInt-8 50780764 23 .8 ns/op 0 B/op 0 allocs/op
937+ BenchmarkParseFloat-8 9560934 125 ns/op 0 B/op 0 allocs/op
906938PASS
907- ok _/Users/simonwaldherr/git/golang-benchmarks/parse 4.551s
939+ ok _/Users/simonwaldherr/git/golang-benchmarks/parse 4.053s
908940```
909941
910942### random
@@ -967,11 +999,11 @@ func GenerateRandomString(s int) (string, error) {
967999$ go test -bench . -benchmem
9681000goos: darwin
9691001goarch: amd64
970- BenchmarkMathRand-8 39486104 29.7 ns/op 0 B/op 0 allocs/op
971- BenchmarkCryptoRand-8 5487919 216 ns/op 56 B/op 4 allocs/op
972- BenchmarkCryptoRandString-8 6349160 194 ns/op 128 B/op 3 allocs/op
1002+ BenchmarkMathRand-8 45860341 27.2 ns/op 0 B/op 0 allocs/op
1003+ BenchmarkCryptoRand-8 6705362 175 ns/op 56 B/op 4 allocs/op
1004+ BenchmarkCryptoRandString-8 5791434 208 ns/op 128 B/op 3 allocs/op
9731005PASS
974- ok _/Users/simonwaldherr/git/golang-benchmarks/random 4.614s
1006+ ok _/Users/simonwaldherr/git/golang-benchmarks/random 4.205s
9751007```
9761008
9771009### regexp
@@ -1025,10 +1057,10 @@ func BenchmarkMatchStringGolibs(b *testing.B) {
10251057$ go test -bench . -benchmem
10261058goos: darwin
10271059goarch: amd64
1028- BenchmarkMatchString-8 108385 11555 ns/op 9944 B/op 86 allocs/op
1029- BenchmarkMatchStringCompiled-8 2014852 636 ns/op 0 B/op 0 allocs/op
1030- BenchmarkMatchStringGolibs-8 1863304 589 ns/op 0 B/op 0 allocs/op
1060+ BenchmarkMatchString-8 109479 9868 ns/op 9956 B/op 86 allocs/op
1061+ BenchmarkMatchStringCompiled-8 1579666 792 ns/op 0 B/op 0 allocs/op
1062+ BenchmarkMatchStringGolibs-8 1776057 677 ns/op 0 B/op 0 allocs/op
10311063PASS
1032- ok _/Users/simonwaldherr/git/golang-benchmarks/regexp 5.698s
1064+ ok _/Users/simonwaldherr/git/golang-benchmarks/regexp 5.251s
10331065```
10341066
0 commit comments