Created
August 19, 2016 08:56
-
-
Save myitcv/58589e39c31f5ca660b9949cdfb93093 to your computer and use it in GitHub Desktop.
sort inlining
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ go build -gcflags=-m | |
./main.go:11: can inline dataLess | |
./main.go:25: can inline dataSwap | |
./main.go:164: inlining call to dataLess | |
./main.go:167: inlining call to dataLess | |
./main.go:170: inlining call to dataSwap | |
./main.go:187: inlining call to dataSwap | |
./main.go:198: inlining call to dataLess | |
./main.go:199: inlining call to dataSwap | |
./main.go:202: inlining call to dataLess | |
./main.go:203: inlining call to dataSwap | |
./main.go:205: inlining call to dataLess | |
./main.go:206: inlining call to dataSwap | |
./main.go:80: inlining call to dataLess | |
./main.go:84: inlining call to dataLess | |
./main.go:86: inlining call to dataLess | |
./main.go:92: inlining call to dataSwap | |
./main.go:102: inlining call to dataLess | |
./main.go:103: inlining call to dataSwap | |
./main.go:107: inlining call to dataLess | |
./main.go:114: inlining call to dataLess | |
./main.go:115: inlining call to dataSwap | |
./main.go:128: inlining call to dataLess | |
./main.go:130: inlining call to dataLess | |
./main.go:136: inlining call to dataSwap | |
./main.go:142: inlining call to dataSwap | |
./main.go:149: inlining call to dataLess | |
./main.go:150: inlining call to dataSwap | |
./main.go:51: inlining call to dataLess | |
./main.go:52: inlining call to dataSwap | |
./main.go:214: inlining call to dataSwap | |
./main.go:157: leaking param content: data | |
./main.go:175: leaking param content: data | |
./main.go:196: leaking param content: data | |
./main.go:59: leaking param content: data | |
./main.go:147: leaking param content: data | |
./main.go:29: leaking param content: data | |
./main.go:15: leaking param content: vs | |
./main.go:8: x escapes to heap | |
./main.go:6: []string literal escapes to heap | |
./main.go:8: main ... argument does not escape | |
./main.go:11: dataLess vs does not escape | |
./main.go:25: leaking param content: data | |
./main.go:212: leaking param content: data |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ go test -bench BenchmarkSortString1K | |
testing: warning: no tests to run | |
BenchmarkSortString1K-8 10000 106093 ns/op | |
PASS | |
ok github.com/myitcv/playground 1.855s |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"strconv" | |
"testing" | |
) | |
func BenchmarkSortString1K(b *testing.B) { | |
b.StopTimer() | |
for i := 0; i < b.N; i++ { | |
data := make([]string, 1<<10) | |
for i := 0; i < len(data); i++ { | |
data[i] = strconv.Itoa(i ^ 0x2cc) | |
} | |
b.StartTimer() | |
sortStrings(data) | |
b.StopTimer() | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ go test -bench BenchmarkSortString1K sort | |
BenchmarkSortString1K-8 10000 156673 ns/op | |
PASS | |
ok sort 2.956s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment