@@ -37,7 +37,7 @@ If you\'re interested in new programming languages, you should definitely take a
37
37
38
38
## Benchmark Results
39
39
40
- Golang Version: go version go1.13.3 darwin/amd64
40
+ Golang Version: go version go1.14 darwin/amd64
41
41
42
42
### base64
43
43
@@ -88,10 +88,10 @@ func BenchmarkBase64regex(b *testing.B) {
88
88
$ go test -bench . -benchmem
89
89
goos: darwin
90
90
goarch: 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
93
93
PASS
94
- ok _/Users/simonwaldherr/git/golang-benchmarks/base64 3.749s
94
+ ok _/Users/simonwaldherr/git/golang-benchmarks/base64 2.928s
95
95
```
96
96
97
97
### between
@@ -183,12 +183,12 @@ func BenchmarkFulltextParse(b *testing.B) {
183
183
$ go test -bench . -benchmem
184
184
goos: darwin
185
185
goarch: 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
190
190
PASS
191
- ok _/Users/simonwaldherr/git/golang-benchmarks/between 8.005s
191
+ ok _/Users/simonwaldherr/git/golang-benchmarks/between 5.338s
192
192
```
193
193
194
194
### concat
@@ -234,11 +234,11 @@ func BenchmarkConcatBuilder(b *testing.B) {
234
234
$ go test -bench . -benchmem
235
235
goos: darwin
236
236
goarch: 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
240
240
PASS
241
- ok _/Users/simonwaldherr/git/golang-benchmarks/concat 56.321s
241
+ ok _/Users/simonwaldherr/git/golang-benchmarks/concat 44.077s
242
242
```
243
243
244
244
### contains
@@ -388,16 +388,16 @@ func BenchmarkMatchNot(b *testing.B) {
388
388
$ go test -bench . -benchmem
389
389
goos: darwin
390
390
goarch: 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
399
399
PASS
400
- ok _/Users/simonwaldherr/git/golang-benchmarks/contains 16.158s
400
+ ok _/Users/simonwaldherr/git/golang-benchmarks/contains 11.943s
401
401
```
402
402
403
403
### foreach
@@ -484,12 +484,12 @@ func BenchmarkRangeSliceKey(b *testing.B) {
484
484
$ go test -bench . -benchmem
485
485
goos: darwin
486
486
goarch: 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
491
491
PASS
492
- ok _/Users/simonwaldherr/git/golang-benchmarks/foreach 6.098s
492
+ ok _/Users/simonwaldherr/git/golang-benchmarks/foreach 5.934s
493
493
```
494
494
495
495
### hash
@@ -505,14 +505,18 @@ import (
505
505
" crypto/sha1"
506
506
" crypto/sha256"
507
507
" crypto/sha512"
508
- " github.com/jzelinskie/whirlpool"
509
- " golang.org/x/crypto/sha3"
510
508
" hash"
511
509
" hash/adler32"
512
510
" hash/crc32"
513
511
" hash/fnv"
514
512
" math/rand"
515
513
" 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"
516
520
)
517
521
518
522
func benchmarkHashAlgo (b *testing .B , h hash .Hash ) {
@@ -530,6 +534,30 @@ func BenchmarkAdler32(b *testing.B) {
530
534
benchmarkHashAlgo (b, adler32.New ())
531
535
}
532
536
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
+
533
561
func BenchmarkCRC32 (b *testing .B ) {
534
562
benchmarkHashAlgo (b, crc32.NewIEEE ())
535
563
}
@@ -571,18 +599,22 @@ func BenchmarkWhirlpool(b *testing.B) {
571
599
$ go test -bench . -benchmem
572
600
goos: darwin
573
601
goarch: 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
584
616
PASS
585
- ok _/Users/simonwaldherr/git/golang-benchmarks/hash 14.421s
617
+ ok _/Users/simonwaldherr/git/golang-benchmarks/hash 20.138s
586
618
```
587
619
588
620
### index
@@ -665,10 +697,10 @@ func BenchmarkMapIntKeys(b *testing.B) {
665
697
$ go test -bench . -benchmem
666
698
goos: darwin
667
699
goarch: 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
670
702
PASS
671
- ok _/Users/simonwaldherr/git/golang-benchmarks/index 4.415s
703
+ ok _/Users/simonwaldherr/git/golang-benchmarks/index 4.156s
672
704
```
673
705
674
706
### json
@@ -759,10 +791,10 @@ func BenchmarkJsonUnmarshal(b *testing.B) {
759
791
$ go test -bench . -benchmem
760
792
goos: darwin
761
793
goarch: 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
764
796
PASS
765
- ok _/Users/simonwaldherr/git/golang-benchmarks/json 3.923s
797
+ ok _/Users/simonwaldherr/git/golang-benchmarks/json 2.646s
766
798
```
767
799
768
800
### math
@@ -845,16 +877,16 @@ func BenchmarkMathFloat64(b *testing.B) {
845
877
$ go test -bench . -benchmem
846
878
goos: darwin
847
879
goarch: 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
856
888
PASS
857
- ok _/Users/simonwaldherr/git/golang-benchmarks/math 7.156s
889
+ ok _/Users/simonwaldherr/git/golang-benchmarks/math 7.624s
858
890
```
859
891
860
892
### parse
@@ -900,11 +932,11 @@ func BenchmarkParseFloat(b *testing.B) {
900
932
$ go test -bench . -benchmem
901
933
goos: darwin
902
934
goarch: 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
906
938
PASS
907
- ok _/Users/simonwaldherr/git/golang-benchmarks/parse 4.551s
939
+ ok _/Users/simonwaldherr/git/golang-benchmarks/parse 4.053s
908
940
```
909
941
910
942
### random
@@ -967,11 +999,11 @@ func GenerateRandomString(s int) (string, error) {
967
999
$ go test -bench . -benchmem
968
1000
goos: darwin
969
1001
goarch: 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
973
1005
PASS
974
- ok _/Users/simonwaldherr/git/golang-benchmarks/random 4.614s
1006
+ ok _/Users/simonwaldherr/git/golang-benchmarks/random 4.205s
975
1007
```
976
1008
977
1009
### regexp
@@ -1025,10 +1057,10 @@ func BenchmarkMatchStringGolibs(b *testing.B) {
1025
1057
$ go test -bench . -benchmem
1026
1058
goos: darwin
1027
1059
goarch: 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
1031
1063
PASS
1032
- ok _/Users/simonwaldherr/git/golang-benchmarks/regexp 5.698s
1064
+ ok _/Users/simonwaldherr/git/golang-benchmarks/regexp 5.251s
1033
1065
```
1034
1066
0 commit comments