Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
701b2f3bfd | |||
bac89d8301 |
@ -7,6 +7,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/dosco/super-graph/core/internal/qcode"
|
"github.com/dosco/super-graph/core/internal/qcode"
|
||||||
@ -1355,23 +1356,5 @@ func squoted(w io.Writer, identifier string) {
|
|||||||
const charset = "0123456789"
|
const charset = "0123456789"
|
||||||
|
|
||||||
func int32String(w io.Writer, val int32) {
|
func int32String(w io.Writer, val int32) {
|
||||||
if val < 10 {
|
io.WriteString(w, strconv.FormatInt(int64(val), 10))
|
||||||
w.Write([]byte{charset[val]})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
temp := int32(0)
|
|
||||||
val2 := val
|
|
||||||
for val2 > 0 {
|
|
||||||
temp *= 10
|
|
||||||
temp += val2 % 10
|
|
||||||
val2 = int32(float64(val2 / 10))
|
|
||||||
}
|
|
||||||
|
|
||||||
val3 := temp
|
|
||||||
for val3 > 0 {
|
|
||||||
d := val3 % 10
|
|
||||||
val3 /= 10
|
|
||||||
w.Write([]byte{charset[d]})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
11
core/internal/qcode/bench.10
Normal file
11
core/internal/qcode/bench.10
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
goos: darwin
|
||||||
|
goarch: amd64
|
||||||
|
pkg: github.com/dosco/super-graph/core/internal/qcode
|
||||||
|
BenchmarkQCompile-16 120888 9236 ns/op 3755 B/op 28 allocs/op
|
||||||
|
BenchmarkQCompileP-16 502248 2620 ns/op 3795 B/op 28 allocs/op
|
||||||
|
BenchmarkParse-16 128370 9294 ns/op 3902 B/op 18 allocs/op
|
||||||
|
BenchmarkParseP-16 575752 2340 ns/op 3903 B/op 18 allocs/op
|
||||||
|
BenchmarkSchemaParse-16 212048 5779 ns/op 3968 B/op 57 allocs/op
|
||||||
|
BenchmarkSchemaParseP-16 630918 1686 ns/op 3968 B/op 57 allocs/op
|
||||||
|
PASS
|
||||||
|
ok github.com/dosco/super-graph/core/internal/qcode 7.710s
|
Reference in New Issue
Block a user