From e31bf70c44c85559d5743fdd645ba6936b83c49d Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Sun, 5 Apr 2015 17:09:46 +0200 Subject: Add insert benchmark --- stack_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'stack_test.go') diff --git a/stack_test.go b/stack_test.go index 31e6ff7..bdb5c0e 100644 --- a/stack_test.go +++ b/stack_test.go @@ -86,3 +86,21 @@ func BenchmarkPushPopAlot(b *testing.B) { s.Pop() } } + +func BenchmarkInsetPopSingle(b *testing.B) { + s := NewStack() + for i := 0; i < b.N; i++ { + s.Insert(1) + s.Pop() + } +} + +func BenchmarkInsetPopAlot(b *testing.B) { + s := NewStack() + for i := 0; i < b.N; i++ { + s.Insert(i) + } + for i := 0; i < b.N; i++ { + s.Pop() + } +} -- cgit v1.2.3