generated from openacid/gotmpl
-
Notifications
You must be signed in to change notification settings - Fork 3
/
sskv_example_big_test.go
47 lines (39 loc) · 1.03 KB
/
sskv_example_big_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package succinct
import (
"fmt"
"github.com/openacid/low/size"
"github.com/openacid/testkeys"
)
func ExampleNewSet_memory() {
keys := testkeys.Load("200kweb2")
original := 0
for _, k := range keys {
original += len(k)
}
s := NewSet(keys)
fmt.Println("With", len(keys)/1000, "thousands keys:")
fmt.Println(" Original size:", original/1024, "KB")
fmt.Println(" Compressed size:",
size.Of(s)/1024, "KB, ratio:",
size.Of(s)*100/original, "%")
fmt.Println("Memory layout:")
fmt.Println(size.Stat(s, 10, 1))
// Output:
//
// With 235 thousands keys:
// Original size: 2204 KB
// Compressed size: 1258 KB, ratio: 57 %
// Memory layout:
// *succinct.Set: 1288412
// succinct.Set: 1288404
// leaves: []uint64: 99128
// 0: uint64: 8
// labelBitmap: []uint64: 198224
// 0: uint64: 8
// labels: []uint8: 792800
// 0: uint8: 1
// ranks: []int32: 99128
// 0: int32: 4
// selects: []int32: 99124
// 0: int32: 4
}