febird.dataio和boost.serialization性能对比

项目地址:http://code.google.com/p/febird

 

和boost.serialization性能对比

运行性能

以下数据是对POD数据,都使用典型用法。febird使用

DATA_IO_LOAD_SAVE(Class, &a&b&c)

boost也使用这样的简化形式:

#define DATA_IO_LOAD_SAVE(Class, Members) /

    friend class boost::serialization::access; /

    template<class Archive> /

    void serialize(Archive & ar, const unsigned int version) /

    { ar Members; }

 

因为febird进行了自动优化,而boost需要用户执行优化。并且febird可以在不改变的代码的情况下,就可以写成Portable数据格式,即使使用Portable,转化了字节序,仍然比boost快得多(10倍以上)。但是对基本数据类型的vector,两者的性能差不多,因为boost对简单数据类型做了优化。

读写文件

前提是在缓存的情况下,对POD数据的操作,平均快20倍。

boost配置

boost::archive::binary_oarchive

boost::archive::binary_iarchive

febird配置

febird::NativeDataOutput<OutputBuffer>àFileStream

febird::NativeDataInput<InputBuffer>àFileStream

 

读写内存,平均快50倍

boost配置

boost::archive::binary_oarchive

boost::archive::binary_iarchive

febird配置

febird::NativeDataOutput<AutoGrowMemIO>

febird::NativeDataInput<MemIO>

febird极速模式

febird::NativeDataOutput<MinMemIO>

febird::NativeDataInput<MinMemIO>

比boost快1500倍

编译性能

使用自动生成的代码,迭代所有的基本类型,shuffle后生成20个POD类型。

对stl标准容器和基本类型代码迭代,生成20个complex类型。

然后读写这些类型。

编译+连接时间

目标文件尺寸(KB)

*.exe

*.pdb

boost-debug

61秒

5,739

30,627

febird-debug

23秒

2,129

14,771

boost-release

155秒

1,794

14,775

febird-release

54秒

384

4,451

 

项目地址:http://code.google.com/p/febird

 

原文地址:https://www.cnblogs.com/hzcya1995/p/13318631.html