summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-04-05 17:09:46 +0200
committerDimitri Sokolyuk <demon@dim13.org>2015-04-05 17:09:46 +0200
commite31bf70c44c85559d5743fdd645ba6936b83c49d (patch)
treeee849a8f3a882ebb605c11d76960a60482f0967f
parentbdecd1b6e0ea6d9bf6c205d418ac989c0aa0deb1 (diff)
Add insert benchmark
-rw-r--r--stack_test.go18
1 files changed, 18 insertions, 0 deletions
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()
+ }
+}