Skip to content

Commit

Permalink
doc: slimtrie: update report, use better color scheme, refine chart l…
Browse files Browse the repository at this point in the history
…abel
  • Loading branch information
drmingdrmer committed Sep 18, 2019
1 parent a9b21c7 commit 9175a3a
Show file tree
Hide file tree
Showing 22 changed files with 283 additions and 268 deletions.
27 changes: 9 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ memory, as a minimized index of huge amount external data.
**Features**:

- **Minimized**:
**11 bits per key**(even less than an 8-byte pointer!!).
**11 bits per key**(far less than an 64-bits pointer!!).

- **Stable**:
memory consumption is stable in various scenarios.
Expand Down Expand Up @@ -97,33 +97,24 @@ memory, as a minimized index of huge amount external data.

<!-- TODO toc -->

## Memory overhead
<!-- TODO add FPR benchmark -->

**Bits/key** is stable when key-count(`n`) increases,
and does not relate to key-length(`k`) either!
## Memory overhead

The more dense a key set is, the less memory a trie-like data structure costs.
**Bits/key**: memory or disk-space in bits a key consumed in average.
It does not change when key-length(`k`) becomes larger!

![](trie/report/mem_usage.jpg)

| key-count | k=64 | k=128 | k=256 |
|-----------|------|-------|-------|
| 1000 | 16 | 16 | 16 |
| 2000 | 13 | 13 | 13 |
| 5000 | 14 | 14 | 14 |


## Performance

The following chart shows the time(in nano second) spent on a `Get()` operation
with golang-map, SlimTrie, array and [btree][] by google.
It is about **2.2 times faster** than the [btree][] by google, or **1.5 times
faster** than binary search on a sorted array.
**Smaller is better**.
Time(in nano second) spent on a `Get()` with golang-map, SlimTrie, array and [btree][] by google.

<!-- use img instead of markdown image to control width -->
- **3.3 times faster** than the [btree][].
- **2.3 times faster** than binary search.

<img src="docs/trie/charts/bench_get_2019_06_04.png" width="400px"/>
![](trie/report/bench_msab_present.jpg)


Time(in nano second) spent on a `Get()` with different key count(`n`) and key length(`k`):
Expand Down
86 changes: 57 additions & 29 deletions benchhelper/plot.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,31 @@ var Fformat = struct {
}{
JPGHistogramTiny: `
set terminal jpeg size 300,200;
set boxwidth 0.8;
set style fill solid;
# the bar width
set boxwidth 0.7 relative
set style fill solid border;
# show horizontal grid
set grid ytics;
set style line 101 lc rgb '#909090' lt 1 lw 1
# left and bottom border
set border 3 front ls 101
# plot title at the right top
set key font ",8"
# x-axis, the numbers
set tics font "Verdana,8"
# space between x-axis and x-tics label
set xtics offset 0,0.3,0
# cluster spacing is 1(bar-width)
set style histogram cluster gap 1
`,
JPGHistogramSmall: `
set terminal jpeg size 400,300;
Expand All @@ -43,36 +62,45 @@ set border 3 front ls 101
}

var LineStyles = struct {
Green string
Yellow string
Orange string
Colorful string
Green string
Yellow string
Orange string
}{
Colorful: `
set style line 1 lc rgb '#4688F1' pt 1 ps 1 lt 1 lw 2;
set style line 2 lc rgb '#CA4E5D' pt 6 ps 1 lt 1 lw 2;
set style line 3 lc rgb '#79A2F1' pt 6 ps 1 lt 1 lw 2;
set style line 4 lc rgb '#8ED0F1' pt 6 ps 1 lt 1 lw 2;
set style line 5 lc rgb '#8AE7CC' pt 6 ps 1 lt 1 lw 2;
set style line 1 lc rgb '#4688F1' pt 1 ps 1 lt 1 lw 2;
set style line 2 lc rgb '#6CA8F3' pt 6 ps 1 lt 1 lw 2;
set style line 3 lc rgb '#79A2F1' pt 6 ps 1 lt 1 lw 2;
set style line 4 lc rgb '#8ED0F1' pt 6 ps 1 lt 1 lw 2;
set style line 5 lc rgb '#8AE7CC' pt 6 ps 1 lt 1 lw 2;
`,
Green: `
set style line 1 lc rgb '#aaffa5' pt 1 ps 1 lt 1 lw 2;
set style line 2 lc rgb '#99f094' pt 6 ps 1 lt 1 lw 2;
set style line 3 lc rgb '#87e082' pt 6 ps 1 lt 1 lw 2;
set style line 4 lc rgb '#76d171' pt 6 ps 1 lt 1 lw 2;
set style line 5 lc rgb '#65c260' pt 6 ps 1 lt 1 lw 2;
set style line 6 lc rgb '#54b34f' pt 6 ps 1 lt 1 lw 2;
set style line 7 lc rgb '#42a33d' pt 6 ps 1 lt 1 lw 2;
set style line 8 lc rgb '#31942c' pt 6 ps 1 lt 1 lw 2;
set style line 1 lc rgb '#a2e2b8' pt 1 ps 1 lt 1 lw 2;
set style line 2 lc rgb '#6ecd9b' pt 6 ps 1 lt 1 lw 2;
set style line 3 lc rgb '#5db191' pt 6 ps 1 lt 1 lw 2;
set style line 4 lc rgb '#519d7f' pt 6 ps 1 lt 1 lw 2;
set style line 5 lc rgb '#49856e' pt 6 ps 1 lt 1 lw 2;
`,
Yellow: `
set style line 1 lc rgb '#e6f082' pt 1 ps 1 lt 1 lw 2;
set style line 2 lc rgb '#dfeb5f' pt 6 ps 1 lt 1 lw 2;
set style line 3 lc rgb '#d4e52b' pt 6 ps 1 lt 1 lw 2;
set style line 1 lc rgb '#e9d16c' pt 1 ps 1 lt 1 lw 2;
set style line 2 lc rgb '#e2c444' pt 6 ps 1 lt 1 lw 2;
set style line 3 lc rgb '#daaf08' pt 6 ps 1 lt 1 lw 2;
set style line 4 lc rgb '#cfb033' pt 6 ps 1 lt 1 lw 2;
set style line 5 lc rgb '#ad8a00' pt 6 ps 1 lt 1 lw 2;
`,
Orange: `
set style line 1 lc rgb '#ffdd00' pt 1 ps 1 lt 1 lw 2;
set style line 2 lc rgb '#f9d000' pt 6 ps 1 lt 1 lw 2;
set style line 3 lc rgb '#f4c300' pt 6 ps 1 lt 1 lw 2;
set style line 4 lc rgb '#eeb500' pt 6 ps 1 lt 1 lw 2;
set style line 5 lc rgb '#e8a800' pt 6 ps 1 lt 1 lw 2;
set style line 6 lc rgb '#e39b00' pt 6 ps 1 lt 1 lw 2;
set style line 7 lc rgb '#dd8e00' pt 6 ps 1 lt 1 lw 2;
set style line 8 lc rgb '#d78000' pt 6 ps 1 lt 1 lw 2;
set style line 9 lc rgb '#d27300' pt 6 ps 1 lt 1 lw 2;
set style line 10 lc rgb '#cc6600' pt 6 ps 1 lt 1 lw 2;
set style line 1 lc rgb '#edbe8a' pt 1 ps 1 lt 1 lw 2;
set style line 2 lc rgb '#e29543' pt 6 ps 1 lt 1 lw 2;
set style line 3 lc rgb '#da7409' pt 6 ps 1 lt 1 lw 2;
set style line 4 lc rgb '#c16400' pt 6 ps 1 lt 1 lw 2;
set style line 5 lc rgb '#ad5900' pt 6 ps 1 lt 1 lw 2;
`,
}

Expand All @@ -84,9 +112,9 @@ stats fn skip 1 nooutput
max_col = STATS_columns
plot for [col=2:max_col] fn \
using col:xtic(1) \
with histogram \
linestyle col-1 \
using col:xticlabels(gprintf('10^{%T}',column(1))) \
with histogram \
linestyle col-1 \
title columnheader
`,
}
Expand Down
23 changes: 9 additions & 14 deletions docs/README.md.j2
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ memory, as a minimized index of huge amount external data.
**Features**:

- **Minimized**:
**11 bits per key**(even less than an 8-byte pointer!!).
**11 bits per key**(far less than an 64-bits pointer!!).

- **Stable**:
memory consumption is stable in various scenarios.
Expand Down Expand Up @@ -95,29 +95,24 @@ memory, as a minimized index of huge amount external data.

<!-- TODO toc -->

## Memory overhead
<!-- TODO add FPR benchmark -->

**Bits/key** is stable when key-count(`n`) increases,
and does not relate to key-length(`k`) either!
## Memory overhead

The more dense a key set is, the less memory a trie-like data structure costs.
**Bits/key**: memory or disk-space in bits a key consumed in average.
It does not change when key-length(`k`) becomes larger!

![](trie/report/mem_usage.jpg)

{% include 'trie/report/mem_usage.md' %}


## Performance

The following chart shows the time(in nano second) spent on a `Get()` operation
with golang-map, SlimTrie, array and [btree][] by google.
It is about **2.2 times faster** than the [btree][] by google, or **1.5 times
faster** than binary search on a sorted array.
**Smaller is better**.
Time(in nano second) spent on a `Get()` with golang-map, SlimTrie, array and [btree][] by google.

<!-- use img instead of markdown image to control width -->
- **3.3 times faster** than the [btree][].
- **2.3 times faster** than binary search.

<img src="docs/trie/charts/bench_get_2019_06_04.png" width="400px"/>
![](trie/report/bench_msab_present.jpg)


Time(in nano second) spent on a `Get()` with different key count(`n`) and key length(`k`):
Expand Down
140 changes: 0 additions & 140 deletions trie/bench_search_test.go

This file was deleted.

Loading

0 comments on commit 9175a3a

Please sign in to comment.