Browse Source

codec: test: remove benchmark tests mistakenly added here

Benchmarks should all be in the go-codec-bench repo
Ugorji Nwoke 8 years ago
parent
commit
768a92b35f
2 changed files with 0 additions and 172 deletions
  1. 0 123
      codec/x_bench_gen_test.go
  2. 0 49
      codec/z_all_x_bench_gen_test.go

+ 0 - 123
codec/x_bench_gen_test.go

@@ -1,123 +0,0 @@
-// +build x
-// +build generated
-
-// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
-// Use of this source code is governed by a MIT license found in the LICENSE file.
-
-package codec
-
-import (
-	"bytes"
-	"errors"
-	"fmt"
-	"testing"
-
-	"github.com/mailru/easyjson"
-	"github.com/pquerna/ffjson/ffjson"
-	"github.com/tinylib/msgp/msgp"
-)
-
-/*
- To update all these, use:
- go get -u github.com/tinylib/msgp/msgp github.com/tinylib/msgp \
-           github.com/pquerna/ffjson/ffjson github.com/pquerna/ffjson \
-           github.com/mailru/easyjson/...
-
- Known Issues with external libraries:
- - msgp io.R/W support doesn't work. It throws error
-
-*/
-
-func init() {
-	testPreInitFns = append(testPreInitFns, benchXGenPreInit)
-}
-
-func benchXGenPreInit() {
-	benchCheckers = append(benchCheckers,
-		benchChecker{"msgp", fnMsgpEncodeFn, fnMsgpDecodeFn},
-		benchChecker{"easyjson", fnEasyjsonEncodeFn, fnEasyjsonDecodeFn},
-		benchChecker{"ffjson", fnFfjsonEncodeFn, fnFfjsonDecodeFn},
-	)
-}
-
-func fnEasyjsonEncodeFn(ts interface{}, bsIn []byte) ([]byte, error) {
-	if _, ok := ts.(easyjson.Marshaler); !ok {
-		return nil, errors.New("easyjson: input is not a easyjson.Marshaler")
-	}
-	if testUseIoEncDec >= 0 {
-		buf := new(bytes.Buffer)
-		_, err := easyjson.MarshalToWriter(ts.(easyjson.Marshaler), buf)
-		return buf.Bytes(), err
-	}
-	return easyjson.Marshal(ts.(easyjson.Marshaler))
-	// return ts.(json.Marshaler).MarshalJSON()
-}
-
-func fnEasyjsonDecodeFn(buf []byte, ts interface{}) error {
-	if _, ok := ts.(easyjson.Unmarshaler); !ok {
-		return errors.New("easyjson: input is not a easyjson.Unmarshaler")
-	}
-	if testUseIoEncDec >= 0 {
-		return easyjson.UnmarshalFromReader(bytes.NewReader(buf), ts.(easyjson.Unmarshaler))
-	}
-	return easyjson.Unmarshal(buf, ts.(easyjson.Unmarshaler))
-	// return ts.(json.Unmarshaler).UnmarshalJSON(buf)
-}
-
-func fnFfjsonEncodeFn(ts interface{}, bsIn []byte) ([]byte, error) {
-	return ffjson.Marshal(ts)
-	// return ts.(json.Marshaler).MarshalJSON()
-}
-
-func fnFfjsonDecodeFn(buf []byte, ts interface{}) error {
-	return ffjson.Unmarshal(buf, ts)
-	// return ts.(json.Unmarshaler).UnmarshalJSON(buf)
-}
-
-func fnMsgpEncodeFn(ts interface{}, bsIn []byte) ([]byte, error) {
-	if _, ok := ts.(msgp.Encodable); !ok {
-		return nil, fmt.Errorf("msgp: input of type %T is not a msgp.Encodable", ts)
-	}
-	if testUseIoEncDec >= 0 {
-		buf := fnBenchmarkByteBuf(bsIn)
-		err := ts.(msgp.Encodable).EncodeMsg(msgp.NewWriter(buf))
-		return buf.Bytes(), err
-	}
-	return ts.(msgp.Marshaler).MarshalMsg(bsIn[:0]) // msgp appends to slice.
-}
-
-func fnMsgpDecodeFn(buf []byte, ts interface{}) (err error) {
-	if _, ok := ts.(msgp.Decodable); !ok {
-		return fmt.Errorf("msgp: input of type %T is not a msgp.Decodable", ts)
-	}
-	if testUseIoEncDec >= 0 {
-		err = ts.(msgp.Decodable).DecodeMsg(msgp.NewReader(bytes.NewReader(buf)))
-		return
-	}
-	_, err = ts.(msgp.Unmarshaler).UnmarshalMsg(buf)
-	return
-}
-
-func Benchmark__Msgp_______Encode(b *testing.B) {
-	fnBenchmarkEncode(b, "msgp", benchTs, fnMsgpEncodeFn)
-}
-
-func Benchmark__Msgp_______Decode(b *testing.B) {
-	fnBenchmarkDecode(b, "msgp", benchTs, fnMsgpEncodeFn, fnMsgpDecodeFn, fnBenchNewTs)
-}
-
-func Benchmark__Easyjson___Encode(b *testing.B) {
-	fnBenchmarkEncode(b, "easyjson", benchTs, fnEasyjsonEncodeFn)
-}
-
-func Benchmark__Easyjson___Decode(b *testing.B) {
-	fnBenchmarkDecode(b, "easyjson", benchTs, fnEasyjsonEncodeFn, fnEasyjsonDecodeFn, fnBenchNewTs)
-}
-
-func Benchmark__Ffjson_____Encode(b *testing.B) {
-	fnBenchmarkEncode(b, "ffjson", benchTs, fnFfjsonEncodeFn)
-}
-
-func Benchmark__Ffjson_____Decode(b *testing.B) {
-	fnBenchmarkDecode(b, "ffjson", benchTs, fnFfjsonEncodeFn, fnFfjsonDecodeFn, fnBenchNewTs)
-}

+ 0 - 49
codec/z_all_x_bench_gen_test.go

@@ -1,49 +0,0 @@
-// +build alltests
-// +build x
-// +build go1.7
-// +build generated
-
-package codec
-
-// see notes in z_all_bench_test.go
-
-import "testing"
-
-func benchmarkCodecXGenGroup(t *testing.B) {
-	logT(nil, "\n-------------------------------\n")
-	t.Run("Benchmark__Msgpack____Encode", Benchmark__Msgpack____Encode)
-	t.Run("Benchmark__Binc_______Encode", Benchmark__Binc_______Encode)
-	t.Run("Benchmark__Simple_____Encode", Benchmark__Simple_____Encode)
-	t.Run("Benchmark__Cbor_______Encode", Benchmark__Cbor_______Encode)
-	t.Run("Benchmark__Json_______Encode", Benchmark__Json_______Encode)
-	t.Run("Benchmark__Std_Json___Encode", Benchmark__Std_Json___Encode)
-	t.Run("Benchmark__Gob________Encode", Benchmark__Gob________Encode)
-	t.Run("Benchmark__JsonIter___Encode", Benchmark__JsonIter___Encode)
-	t.Run("Benchmark__Bson_______Encode", Benchmark__Bson_______Encode)
-	t.Run("Benchmark__VMsgpack___Encode", Benchmark__VMsgpack___Encode)
-	t.Run("Benchmark__Msgp_______Encode", Benchmark__Msgp_______Encode)
-	t.Run("Benchmark__Easyjson___Encode", Benchmark__Easyjson___Encode)
-	t.Run("Benchmark__Ffjson_____Encode", Benchmark__Ffjson_____Encode)
-	t.Run("Benchmark__Gcbor______Encode", Benchmark__Gcbor______Encode)
-	t.Run("Benchmark__Xdr________Encode", Benchmark__Xdr________Encode)
-	t.Run("Benchmark__Sereal_____Encode", Benchmark__Sereal_____Encode)
-
-	t.Run("Benchmark__Msgpack____Decode", Benchmark__Msgpack____Decode)
-	t.Run("Benchmark__Binc_______Decode", Benchmark__Binc_______Decode)
-	t.Run("Benchmark__Simple_____Decode", Benchmark__Simple_____Decode)
-	t.Run("Benchmark__Cbor_______Decode", Benchmark__Cbor_______Decode)
-	t.Run("Benchmark__Json_______Decode", Benchmark__Json_______Decode)
-	t.Run("Benchmark__Std_Json___Decode", Benchmark__Std_Json___Decode)
-	t.Run("Benchmark__Gob________Decode", Benchmark__Gob________Decode)
-	t.Run("Benchmark__JsonIter___Decode", Benchmark__JsonIter___Decode)
-	t.Run("Benchmark__Bson_______Decode", Benchmark__Bson_______Decode)
-	t.Run("Benchmark__VMsgpack___Decode", Benchmark__VMsgpack___Decode)
-	t.Run("Benchmark__Msgp_______Decode", Benchmark__Msgp_______Decode)
-	t.Run("Benchmark__Easyjson___Decode", Benchmark__Easyjson___Decode)
-	t.Run("Benchmark__Ffjson_____Decode", Benchmark__Ffjson_____Decode)
-	t.Run("Benchmark__Gcbor______Decode", Benchmark__Gcbor______Decode)
-	t.Run("Benchmark__Xdr________Decode", Benchmark__Xdr________Decode)
-	t.Run("Benchmark__Sereal_____Decode", Benchmark__Sereal_____Decode)
-}
-
-func BenchmarkCodecXGenSuite(t *testing.B) { benchmarkSuite(t, benchmarkCodecXGenGroup) }