From 560c81d14fd9ad0d450857f743b14f4bd1ab6875 Mon Sep 17 00:00:00 2001 From: Phil Pearl Date: Thu, 18 Jul 2019 15:31:56 +0100 Subject: [PATCH] benchmark for isNilInterface --- helpers_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 helpers_test.go diff --git a/helpers_test.go b/helpers_test.go new file mode 100644 index 0000000..a10a46c --- /dev/null +++ b/helpers_test.go @@ -0,0 +1,12 @@ +package easyjson + +import "testing" + +func BenchmarkNilCheck(b *testing.B) { + var a *int + for i := 0; i < b.N; i++ { + if !isNilInterface(a) { + b.Fatal("expected it to be nil") + } + } +}