Skip to content

Commit

Permalink
fix benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
liuq19 committed Aug 31, 2022
1 parent 3885028 commit 02f88d6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 88 deletions.
24 changes: 2 additions & 22 deletions internal/native/avx/fastfloat_amd64_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 2 additions & 22 deletions internal/native/avx2/fastfloat_amd64_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 2 additions & 22 deletions internal/native/fastfloat_amd64_test.tmpl
Expand Up @@ -48,28 +48,8 @@ func TestFastFloat_Encode(t *testing.T) {
assert.Equal(t, "-2.2250738585072014e-308" , string(buf[:__f64toa(&buf[0], -2.2250738585072014e-308)]))
}

func TestFastFloat_Base(t *testing.T) {
var buf [32]byte
var f32 float32 = float32(0.115719385)
jout, jerr := json.Marshal(f32)
n := __f32toa(&buf[0], f32)
if jerr == nil {
assert.Equal(t, jout, buf[:n])
} else {
assert.True(t, n == 0)
}
}

func TestFastFloat_Random(t *testing.T) {
var buf [32]byte
var f32 float32 = float32(0.115719385)
jout, jerr := json.Marshal(f32)
n := __f32toa(&buf[0], f32)
if jerr == nil {
assert.Equal(t, jout, buf[:n])
} else {
assert.True(t, n == 0)
}
var buf [64]byte
N := 10000
for i := 0; i < N; i++ {
b64 := uint64(rand.Uint32())<<32 | uint64(rand.Uint32())
Expand Down Expand Up @@ -114,7 +94,7 @@ var ftoaBenches = []struct {
{"32Shortest", 1.234567e-8, 32},
}

func BenchmarkAppendFloat(b *testing.B) {
func BenchmarkParseFloat(b *testing.B) {
for _, c := range ftoaBenches {
f64bench := []struct {
name string
Expand Down
24 changes: 2 additions & 22 deletions internal/native/sse4/fastfloat_amd64_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 02f88d6

Please sign in to comment.