Example #1
0
func TestStringVectorNums(t *testing.T) {
	var v StringVector
	c := ""
	malloc.GC()
	m0 := *malloc.GetStats()
	v.Resize(memTestN, memTestN)
	for i := 0; i < memTestN; i++ {
		v.Set(i, c)
	}
	malloc.GC()
	m := *malloc.GetStats()
	v.Resize(0, 0)
	malloc.GC()
	n := m.Alloc - m0.Alloc
	t.Logf("%T.Push(%#v), n = %s: Alloc/n = %.2f\n", v, c, s(memTestN), float(n)/memTestN)
}
Example #2
0
func BenchmarkIntVectorNums(b *testing.B) {
	c := int(0)
	var v IntVector
	b.StopTimer()
	malloc.GC()
	b.StartTimer()
	for i := 0; i < b.N; i++ {
		v.Push(c)
	}
}
Example #3
0
func BenchmarkStringVectorNums(b *testing.B) {
	c := ""
	var v StringVector
	b.StopTimer()
	malloc.GC()
	b.StartTimer()
	for i := 0; i < b.N; i++ {
		v.Push(c)
	}
}