Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Modern C++ B-tree containers

License

NotificationsYou must be signed in to change notification settings

Kronuz/cpp-btree

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Code in this repository is based onGoogle's B-tree implementation.

C++ B-tree is a template library that implements ordered in-memory containersbased on a B-tree data structure. Similar to the STLstd::map,std::set,std::multimap, andstd::multiset templates, this library providesbtree::map,btree::set,btree::multimap andbtree::multiset.

This difers from the original project by Google in that containers behave morelike modern STL (C++17) and are an almost drop-in replacements (except for theiterator invalidation, see below); including support foremplace andtry_emplace as well as values in the map not needing to have a defaultconstructor.

C++ B-tree containers have a few advantages compared with the standardcontainers, which are typically implemented using Red-Black trees. Nodes in aRed-Black tree require three pointers per entry (plus 1 bit), whereas B-treeson average make use of fewer than one pointer per entry, leading tosignificant memory savings. For example, aset<int32_t> has an overheadof 16 bytes for every 4 byte set element (on a 32-bit operating system); thecorrespondingbtree::set<int32_t> has an overhead of around 1 byte per setelement.

B-trees are widely known as data structures for secondary storage, because theykeep disk seeks to a minimum. For an in-memory data structure, the same propertyyields a performance boost by keeping cache-line misses to a minimum. C++ B-treecontainers make better use of the cache by performing multiple key-comparisonsper node when searching the tree. Although B-tree algorithms are more complex,compared with the Red-Black tree algorithms, the improvement in cache behaviormay account for asignificant speedup in accessing large containers.

The C++ B-tree containers are not without drawbacks, however. Unlike thestandard STL containers, modifying a C++ B-tree containerinvalidates all outstanding iterators on that container.

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp