-
-
Notifications
You must be signed in to change notification settings - Fork 18
/
updateBenchLogs.sh
executable file
·69 lines (51 loc) · 2.42 KB
/
updateBenchLogs.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash
declare -a benchs=(base64 between caseinsensitivecompare concat contains floodfill foreach hash index json math parse random regexp template trim)
cat > README.md <<- EOM
# Go Benchmarks
[![DOI](https://zenodo.org/badge/154216722.svg)](https://zenodo.org/badge/latestdoi/154216722)
[![Go Report Card](https://goreportcard.com/badge/github.com/SimonWaldherr/golang-benchmarks)](https://goreportcard.com/report/github.com/SimonWaldherr/golang-benchmarks)
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
In programming in general, and in Golang in particular, many roads lead to Rome.
From time to time I ask myself which of these ways is the fastest.
In Golang there is a wonderful solution, with \`go test -bench\` you can measure the speed very easily and quickly.
In order for you to benefit from it too, I will publish such benchmarks in this repository in the future.
## ToC
EOM
for i in "${benchs[@]}"
do
echo "* [$i](https://github.com/SimonWaldherr/golang-benchmarks#$i)" >> README.md
done
cat >> README.md <<- EOM
## Golang?
I published another repository where I show some Golang examples.
If you\'re interested in new programming languages, you should definitely take a look at Golang:
* [Golang examples](https://github.com/SimonWaldherr/golang-examples)
* [tour.golang.org](https://tour.golang.org/)
* [Go by example](https://gobyexample.com/)
* [Golang Book](http://www.golang-book.com/)
* [Go-Learn](https://github.com/skippednote/Go-Learn)
## Is it any good?
[Yes](https://news.ycombinator.com/item?id=3067434)
## Benchmark Results
EOM
go fmt ./...
echo -n "Golang Version: " >> README.md
go version >> README.md
echo "" >> README.md
for i in "${benchs[@]}"
do
cd $i
gofmt -s -w -l -e .
echo "### $i" >> ../README.md
echo >> ../README.md
echo "\`\`\`go" >> ../README.md
cat *_test.go >> ../README.md
echo "\`\`\`" >> ../README.md
echo >> ../README.md
echo "\`\`\`" >> ../README.md
echo "$ go test -bench . -benchmem" >> ../README.md
go test -bench . -benchmem >> ../README.md
echo "\`\`\`" >> ../README.md
echo >> ../README.md
cd ..
done