This is presentation material about proposal of Boost B-tree library translated to japanese.
The original material have presented in BoostCon2011 by Beman Dawes.
This is published under Beman's permission.
Investigation on ext4 filesystem of current Linux
This slide focuses on ext4 disk layout.
Ext4 filesystem(2)
http://www.slideshare.net/YoshihiroYunomae/ext4-filesystem2
3. B-tree の基本 (1/2)
● B-treeは平衡多分木
● 全てのリーフノードはルートから同じ距離にある
● ノード1は固定数の要素を持ち、そのうちいくつかは空かも知れ
ない
(it is not unusual for nodes to have hundreds of elements.)
1. 訳注)ノードページ
4. B-tree の基本(2/2)
● 要素はノードページ内で順序づけられて並んでおり、ノードペー
ジも順序付いて並んでいる。
つまりツリー内の全ての要素が順序付いて並んでいる。
● 挿入、削除、検索操作の計算量は比較のため O(log2n) となる
● 挿入、削除、検索操作は O(h) 個のノードに触れる。
h はツリーの高さである;
m をノードページ毎の平均エントリ数とすると、およそ logm(h) で
ある。
h は典型的には一桁の数字である。
9. B-tree の背景
● B-treeは Rudolf Bayerにより発明された。彼が*B*が何を意味
するのかを言うことは無かった。B-treeは彼を称えてBayer tree
と呼ばれるべきだという人もいる。
● Bayerはまた、メモリ内検索のためのRed-Black treeと、ディスク
固有の多次元(例えば空間)検索のためのUniversal B-treeも発
明している。
● Organization and Maintenance of Large Ordered Indexes,
Bayer and McCreight, 1972 がオリジナルの論文である。
● The Ubiquitous B-Tree, Douglas Comer, 1979, は素晴らしい
読み物だ。
18. // std::
template <class Key, class T,
class Compare = less<Key>,
class Allocator = allocator<pair<const Key, T>
>>
class map;
// boost::btree::
template <class Key, class T,
class Traits = default_endian_traits,
class Compare = btree::less<Key> >
class btree_map;
36. ノードサイズ: btree_map vs std::map
(5,000,000 calls - 3,160,338 size)
Node insert find iterate erase
size
512 5.54 sec 6.08 sec 0.07 sec 6.25 sec
1.39 ratio 1.65 ratio 0.38 ratio 1.41 ratio
1024 4.83 sec 5.25 sec 0.6 sec 5.33 sec
1.20 ratio 1.43 ratio 0.29 ratio 1.23 ratio
2048 4.30 sec 0.3 sec 0.05 sec 4.29
1.08 ratio 1.12 ratio 0.26 ratio 0.97 ratio
4096 .45 sec 3.67 sec 0.04 sec 4.16 sec
1.13 ratio 1.03 ratio 0.22 ratio 0.92 ratio
8192 5.20 sec 3.42 sec 0.04 sec 4.45 sec
1.34 ratio 0.93 ratio 0.22 ratio 1.01 ratio
16380 5.84 sec 2.70 sec 0.4 sec 4.59 sec
1.50 ratio 0.75 ratio 0.22 ratio 1.06 ratio