My favorites | Sign in
Project Home Wiki Issues Source
Project Information
Members
Links

This Library Contains

  • Contributors are eagerly required.
    • please contact me: rockeet@gmail.com
  • serialization framework(vs boost.serialization/google.protocolbuffer)
    • Basic
    Can be used in protocol parsing, big/small data serialization, even in very small object serialize, performance is good. (such as key/data serialization in BerkeleyDB), febird.DataIO is very fast: (30~1000 times faster than boost.binary_archive), and very low memory usage (ONLY 2 PTR for deserialization).
    • Declarational syntax
      • Such as: DATA_IO_LOAD_SAVE(Point3D, &x&y&z)
      • Support all primitives and stl containers and std::string
      • Byteswaping Support by different serializer
        • NativeDataInput, NativeDataOutput: No byte swaping
        • LittleEndianDataInput, LittleEndianDataOutput: Compile time select if or not swap
        • BigEndianDataInput, BigEndianDataOutput: Compile time select if or not swap
      • Optional version numbering (where boost.serialization always do)

  • Use BerkelyDB as std::map and std::multimap
febird.DataIO is used for auto key/value serialization and deserialization, the interface is very simple and clean. See the code for detail.
  • febird.rpc
A C++ remote procedure call without an IDL supporting, it based on the serialization framework. febird.rpc provide convenient usage and fast performance, and an uniform coding style.
  • most stl algorithm(sort/heap/find...) in C and for both C/C++
Provide high performance(same as stl) through C-Preprocessor Tricky.
  • threaded red-black tree implementation
    • Kernel is written in C, and C++ interface(interface is similiar with std::map/set) is supported also
    My implementation is fast(no compare function overhead for primitive types) but has no code explosion, because I used a C-preprocessor tricky.
    • MultiIndexing (Foreign-Key in relational data base)
      • All indexing pointers are in one node, didn't need separated node
      • std::map/set can used for implementing Foreign Key indexing, but separated map/set is need, which hold a pointer to primary index(which hold data)
      • Compare to boost.multi_index, boost.multi_index didn't need separated node for indexing, but it is compile-time-dynamic multi-index, and its compile speed is very slow
      • my multi-index is runtime-dynamic multi-index, multi-index can be added or dropped at runtime, and compile speed is very fast
      • so my multi-index can be use as a DataBase storage engine, such as MySQL's Storage engine.
    • support 'compute sums in log(n) time'
    All of the SQL aggregate functions: SUM, AVG, MAX, MIN, COUNT for a range can be implemented by the algorithm. see trb_sum_test, Implementation: Recompute aggregation in subtree after Rotatation
  • hash_strmap
    • A very fast hash string keyed hash map
      • 40 times faster than std::map<std::string, ...>
      • 10 times faster than std::unordered_map<std::string, ...>
      • Saved at least 50% memory usage than std::map and unordered_map
    • Expose STL container interface
    • Support sorting and searching (after sort, insert and erase should be prohibited)
      • No extra memory for sorting (just sort and relink)
      • Support sorting by key(string) and value(mapped type)
      • sorting by key(string) then search by string prefix
    • Other minor features
  • Linked list radix sorting algorithm
    • Perfectly supporting variable-length keys, or arbitrary-length string, my implementation is not by padding 0 bytes/chars:
    •  let m = array.length, n = sum(array[*].key.length), maxkeylen=max([*].key.length);
       the time comlexity of my algorithm is O(n), but the traditional algorithm is O(m*maxkeylen).
    See the code for detail: RadixSortTest, Implementation: radix_sort.h radix_sort.cpp

Chinese Introduction

febird 库包含以下部分

  • 急切期望合作贡献者
    • 请联系我: rockeet@gmail.com

功能类似于 boost.serializaiton 或 google.protocolbuffer, 可以用在协议解析,大/小数据的序列化,有极高的性能(比boost.binary_archive快30~80倍),甚至对于非常小的对象也非常适用,例如只有几个字节的对象,这在序列化BerkeleyDB中key/data这么小的对象(可能只是一个整数/变长整数)时要明显优于其它库。
  • BerkeleyDB的序列化封装
构建在该库之上,可以象使用std::map一样使用BerkeleyDB
  • 不需要IDL的rpc
基于该序列化框架,使用几个宏,很方便的自动完成函数参数的序列化,比MFC的MessageMap还要方便。
  • stl算法的C版本,同时提供C++接口
使用了一种C预处理器技巧,提供和stl相当的性能(例如febird_sort远快于qsort,与stl::sort相当)。
  • 线索红黑树(Threaded Red-Black Tree, C核心+C/Cpp接口,仿std::set/map

    • 在提供高性能的同时,没有C++的代码膨胀问题
    因为使用了一个C预处理(C-preprocessor)技巧,详见:线索红黑树中的C预处理迭代
    • 实现了动态多重索引(好比数据库,可以为不同 Key 分别创建索引,外键概念)
      • 不同的索引只消耗一个内存结点,不需要另一个分离的结点
        • stl::map/set 也可以实现多重索引,但是需要另一个的指针 map/set,这个额外的指针 map/set 的结点和主结点是分离的内存结点
      • 对比 boost.multi_index,它也是单节点实现的多重索引,但 boost.multi_index 是编译时确定的多重索引,编译速度超慢
      • 我的多重索引是运行时动态的,可以在运行时添加或删除一个索引,编译速度超快
      • 因此,我的多重索引可以作为数据库存储引擎(比如 MySQL 存储引擎)
    • 实现了 O(log(n)) 时间复杂度的聚集(aggregation)算法
    使用该算法,所有SQL聚集函数:SUM, AVG, MIN, MAX, COUNT 的时间复杂度均是O(log(n)) ,并且,还可以在O(log(n))的时间内找出第n大的元素;更重要的,聚集算法是开放的,可插入的(使用函数指针)。
  • hash_strmap: Key 为 string 的 hash map,我希望有人能找到这个世界上性能更好的 string map
    • 提供 stl container 兼容的接口,使用上和 hash_map/unordered_map<string, Value, Hash, Equal> 几乎完全相同
    • 32 字节的 Key ,3G 的 CPU,单线程,QPS 能达到 35,000,000
    • 同样的测试代码,不管是在 Windows 还是 linux 下,都比 hash_map/unordered_map<string, Value> 快 10 倍,并且使用的内存更少(wordcount程序中节省50%以上的内存)
      • MSVC 中的 unordered_map 有问题,性能出奇地低(查找性能看上去好像是O(n)的),几乎无法完成测试,只能使用 stdext::hash_map

使用时请尽量checkout最新版

@see

我的CSDN博客
我的C++序列化框架介绍
持久化的map:使用BerkeleyDB

Powered by Google Project Hosting