我看了一些https://github.com/RoaringBitmap/roaring分的基准测试
使用-run -
运行特定基准测试时(如第comments条所述):
go test -bench BenchmarkNexts -benchmem -run -
它似乎执行得更快,至少在没有-run -
的情况下运行它似乎有一些5秒的初始开销,如下所示:
==roaring==
{1,2,3,4,5,100,1000}
{3,4,1000}
{}
Cardinality: 7
Contains 3? true
1
3
4
5
1000
Wrote 22 bytes
I wrote the content to a byte stream and read it back.
size before run optimize: 1810 bytes, and after: 38 bytes.
由于-run
标志运行基于正则表达式模式的测试,因此这里似乎排除了某些内容,但实际上两者运行相同测试的内容,唯一的区别是初始开销.