Skip to content

Commit

Permalink
update performance test times to avoid accidental factors (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
tiger lee committed Nov 6, 2023
1 parent 1e43e19 commit 8a25936
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions orderedmap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ func TestGet(t *testing.T) {
t.Skip("performance test skipped in short mode")
}

res1 := testing.Benchmark(benchmarkOrderedMap_Get(1))
res4 := testing.Benchmark(benchmarkOrderedMap_Get(4))
res1 := testing.Benchmark(benchmarkOrderedMap_Get(100))
res4 := testing.Benchmark(benchmarkOrderedMap_Get(400))

// O(1) would mean that res4 should take about the same time as res1,
// because we are accessing the same amount of elements, just on
Expand Down Expand Up @@ -119,8 +119,8 @@ func TestSet(t *testing.T) {
t.Skip("performance test skipped in short mode")
}

res1 := testing.Benchmark(benchmarkOrderedMap_Set(1))
res4 := testing.Benchmark(benchmarkOrderedMap_Set(4))
res1 := testing.Benchmark(benchmarkOrderedMap_Set(100))
res4 := testing.Benchmark(benchmarkOrderedMap_Set(400))

// O(1) would mean that res4 should take about 4 times longer than res1
// because we are doing 4 times the amount of Set operations. Allow for
Expand Down Expand Up @@ -158,8 +158,8 @@ func TestLen(t *testing.T) {
t.Skip("performance test skipped in short mode")
}

res1 := testing.Benchmark(benchmarkOrderedMap_Len(1))
res4 := testing.Benchmark(benchmarkOrderedMap_Len(4))
res1 := testing.Benchmark(benchmarkOrderedMap_Len(100))
res4 := testing.Benchmark(benchmarkOrderedMap_Len(400))

// O(1) would mean that res4 should take about the same time as res1,
// because we are accessing the same amount of elements, just on
Expand Down Expand Up @@ -216,8 +216,8 @@ func TestKeys(t *testing.T) {
t.Skip("performance test skipped in short mode")
}

res1 := testing.Benchmark(benchmarkOrderedMap_Keys(1))
res4 := testing.Benchmark(benchmarkOrderedMap_Keys(4))
res1 := testing.Benchmark(benchmarkOrderedMap_Keys(100))
res4 := testing.Benchmark(benchmarkOrderedMap_Keys(400))

// O(1) would mean that res4 should take about 4 times longer than res1
// because we are doing 4 times the amount of Set/Delete operations.
Expand Down Expand Up @@ -264,8 +264,8 @@ func TestDelete(t *testing.T) {
t.Skip("performance test skipped in short mode")
}

res1 := testing.Benchmark(benchmarkOrderedMap_Delete(1))
res4 := testing.Benchmark(benchmarkOrderedMap_Delete(4))
res1 := testing.Benchmark(benchmarkOrderedMap_Delete(100))
res4 := testing.Benchmark(benchmarkOrderedMap_Delete(400))

// O(1) would mean that res4 should take about 4 times longer than res1
// because we are doing 4 times the amount of Set/Delete operations.
Expand Down Expand Up @@ -344,8 +344,8 @@ func TestGetElement(t *testing.T) {
t.Skip("performance test skipped in short mode")
}

res1 := testing.Benchmark(benchmarkOrderedMap_GetElement(1))
res4 := testing.Benchmark(benchmarkOrderedMap_GetElement(4))
res1 := testing.Benchmark(benchmarkOrderedMap_GetElement(100))
res4 := testing.Benchmark(benchmarkOrderedMap_GetElement(400))

// O(1) would mean that res4 should take about the same time as res1,
// because we are accessing the same amount of elements, just on
Expand Down

0 comments on commit 8a25936

Please sign in to comment.