Skip to content

Commit

Permalink
updated dependencies and copyright notices
Browse files Browse the repository at this point in the history
* updated copyright notices to 2019.

* added copyright notices to files that did not have it.

* split out v1 testing and benchmarks to require build "v1" build tag,
  so v1 is not made a required dependency by regular building and
  testing.
  • Loading branch information
Karrick S. McDermott committed Jan 7, 2019
1 parent 1455199 commit 562b52d
Show file tree
Hide file tree
Showing 50 changed files with 245 additions and 232 deletions.
2 changes: 1 addition & 1 deletion array.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright [2017] LinkedIn Corp. Licensed under the Apache License, Version
// Copyright [2019] LinkedIn Corp. Licensed under the Apache License, Version
// 2.0 (the "License"); you may not use this file except in compliance with the
// License. You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
Expand Down
2 changes: 1 addition & 1 deletion array_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright [2017] LinkedIn Corp. Licensed under the Apache License, Version
// Copyright [2019] LinkedIn Corp. Licensed under the Apache License, Version
// 2.0 (the "License"); you may not use this file except in compliance with the
// License. You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
Expand Down
89 changes: 89 additions & 0 deletions benchmarkV1_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
// Copyright [2019] LinkedIn Corp. Licensed under the Apache License, Version
// 2.0 (the "License"); you may not use this file except in compliance with the
// License. You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

// +build v1

package goavro

import (
"io/ioutil"
"testing"
)

func BenchmarkNewCodecUsingV1(b *testing.B) {
schema, err := ioutil.ReadFile("fixtures/quickstop.avsc")
if err != nil {
b.Fatal(err)
}
b.ResetTimer()
for i := 0; i < b.N; i++ {
_ = newCodecUsingV1(b, string(schema))
}
}

func BenchmarkNativeFromAvroUsingV1(b *testing.B) {
avroBlob, err := ioutil.ReadFile("fixtures/quickstop-null.avro")
if err != nil {
b.Fatal(err)
}
b.ResetTimer()
for i := 0; i < b.N; i++ {
_, _ = nativeFromAvroUsingV1(b, avroBlob)
}
}

func BenchmarkBinaryFromNativeUsingV1(b *testing.B) {
avroBlob, err := ioutil.ReadFile("fixtures/quickstop-null.avro")
if err != nil {
b.Fatal(err)
}
nativeData, codec := nativeFromAvroUsingV1(b, avroBlob)
b.ResetTimer()
for i := 0; i < b.N; i++ {
_ = binaryFromNativeUsingV1(b, codec, nativeData)
}
}

func BenchmarkNativeFromBinaryUsingV1(b *testing.B) {
avroBlob, err := ioutil.ReadFile("fixtures/quickstop-null.avro")
if err != nil {
b.Fatal(err)
}
nativeData, codec := nativeFromAvroUsingV1(b, avroBlob)
binaryData := binaryFromNativeUsingV1(b, codec, nativeData)
b.ResetTimer()
for i := 0; i < b.N; i++ {
_ = nativeFromBinaryUsingV1(b, codec, binaryData)
}
}

func BenchmarkTextualFromNativeUsingJSONMarshal(b *testing.B) {
avroBlob, err := ioutil.ReadFile("fixtures/quickstop-null.avro")
if err != nil {
b.Fatal(err)
}
nativeData, codec := nativeFromAvroUsingV1(b, avroBlob)
b.ResetTimer()
for i := 0; i < b.N; i++ {
_ = textFromNativeUsingJSONMarshal(b, codec, nativeData)
}
}

func BenchmarkNativeFromTextualUsingJSONUnmarshal(b *testing.B) {
avroBlob, err := ioutil.ReadFile("fixtures/quickstop-null.avro")
if err != nil {
b.Fatal(err)
}
nativeData, codec := nativeFromAvroUsingV1(b, avroBlob)
textData := textFromNativeUsingJSONMarshal(b, codec, nativeData)
b.ResetTimer()
for i := 0; i < b.N; i++ {
_ = nativeFromTextUsingJSONUnmarshal(b, codec, textData)
}
}
159 changes: 0 additions & 159 deletions benchmark_helpers_test.go

This file was deleted.

91 changes: 59 additions & 32 deletions benchmark_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright [2017] LinkedIn Corp. Licensed under the Apache License, Version
// Copyright [2019] LinkedIn Corp. Licensed under the Apache License, Version
// 2.0 (the "License"); you may not use this file except in compliance with the
// License. You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
Expand All @@ -9,52 +9,79 @@

package goavro

import "testing"

func BenchmarkNewCodecUsingV1(b *testing.B) {
benchmarkNewCodecUsingV1(b, "fixtures/quickstop.avsc")
}
import (
"io/ioutil"
"testing"
)

func BenchmarkNewCodecUsingV2(b *testing.B) {
benchmarkNewCodecUsingV2(b, "fixtures/quickstop.avsc")
}

func BenchmarkNativeFromAvroUsingV1(b *testing.B) {
benchmarkNativeFromAvroUsingV1(b, "fixtures/quickstop-null.avro")
schema, err := ioutil.ReadFile("fixtures/quickstop.avsc")
if err != nil {
b.Fatal(err)
}
b.ResetTimer()
for i := 0; i < b.N; i++ {
_ = newCodecUsingV2(b, string(schema))
}
}

func BenchmarkNativeFromAvroUsingV2(b *testing.B) {
benchmarkNativeFromAvroUsingV2(b, "fixtures/quickstop-null.avro")
}

func BenchmarkBinaryFromNativeUsingV1(b *testing.B) {
benchmarkBinaryFromNativeUsingV1(b, "fixtures/quickstop-null.avro")
avroBlob, err := ioutil.ReadFile("fixtures/quickstop-null.avro")
if err != nil {
b.Fatal(err)
}
b.ResetTimer()
for i := 0; i < b.N; i++ {
_, _ = nativeFromAvroUsingV2(b, avroBlob)
}
}

func BenchmarkBinaryFromNativeUsingV2(b *testing.B) {
benchmarkBinaryFromNativeUsingV2(b, "fixtures/quickstop-null.avro")
}

func BenchmarkNativeFromBinaryUsingV1(b *testing.B) {
benchmarkNativeFromBinaryUsingV1(b, "fixtures/quickstop-null.avro")
avroBlob, err := ioutil.ReadFile("fixtures/quickstop-null.avro")
if err != nil {
b.Fatal(err)
}
nativeData, codec := nativeFromAvroUsingV2(b, avroBlob)
b.ResetTimer()
for i := 0; i < b.N; i++ {
_ = binaryFromNativeUsingV2(b, codec, nativeData)
}
}

func BenchmarkNativeFromBinaryUsingV2(b *testing.B) {
benchmarkNativeFromBinaryUsingV2(b, "fixtures/quickstop-null.avro")
}

func BenchmarkTextualFromNativeUsingJSONMarshal(b *testing.B) {
benchmarkTextualFromNativeUsingJSONMarshal(b, "fixtures/quickstop-null.avro")
avroBlob, err := ioutil.ReadFile("fixtures/quickstop-null.avro")
if err != nil {
b.Fatal(err)
}
nativeData, codec := nativeFromAvroUsingV2(b, avroBlob)
binaryData := binaryFromNativeUsingV2(b, codec, nativeData)
b.ResetTimer()
for i := 0; i < b.N; i++ {
_ = nativeFromBinaryUsingV2(b, codec, binaryData)
}
}

func BenchmarkTextualFromNativeUsingV2(b *testing.B) {
benchmarkTextualFromNativeUsingV2(b, "fixtures/quickstop-null.avro")
}

func BenchmarkNativeFromTextualUsingJSONUnmarshal(b *testing.B) {
benchmarkNativeFromTextualUsingJSONUnmarshal(b, "fixtures/quickstop-null.avro")
avroBlob, err := ioutil.ReadFile("fixtures/quickstop-null.avro")
if err != nil {
b.Fatal(err)
}
nativeData, codec := nativeFromAvroUsingV2(b, avroBlob)
b.ResetTimer()
for i := 0; i < b.N; i++ {
_ = textFromNativeUsingV2(b, codec, nativeData)
}
}

func BenchmarkNativeFromTextualUsingV2(b *testing.B) {
benchmarkNativeFromTextualUsingV2(b, "fixtures/quickstop-null.avro")
avroBlob, err := ioutil.ReadFile("fixtures/quickstop-null.avro")
if err != nil {
b.Fatal(err)
}
nativeData, codec := nativeFromAvroUsingV2(b, avroBlob)
textData := textFromNativeUsingV2(b, codec, nativeData)
b.ResetTimer()
for i := 0; i < b.N; i++ {
_ = nativeFromTextUsingV2(b, codec, textData)
}
}
2 changes: 1 addition & 1 deletion binaryReader.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright [2017] LinkedIn Corp. Licensed under the Apache License, Version
// Copyright [2019] LinkedIn Corp. Licensed under the Apache License, Version
// 2.0 (the "License"); you may not use this file except in compliance with the
// License. You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
Expand Down
2 changes: 1 addition & 1 deletion binary_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright [2017] LinkedIn Corp. Licensed under the Apache License, Version
// Copyright [2019] LinkedIn Corp. Licensed under the Apache License, Version
// 2.0 (the "License"); you may not use this file except in compliance with the
// License. You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
Expand Down
2 changes: 1 addition & 1 deletion boolean.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright [2017] LinkedIn Corp. Licensed under the Apache License, Version
// Copyright [2019] LinkedIn Corp. Licensed under the Apache License, Version
// 2.0 (the "License"); you may not use this file except in compliance with the
// License. You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
Expand Down
Loading

0 comments on commit 562b52d

Please sign in to comment.