Boost logo

Boost Users :

From: Graham (greitz1_at_[hidden])
Date: 2005-05-25 11:28:51


I am rather new to Boost. I apologize in advance if I miss a protocol or
two in the group. Please correct me.

 

My group is considering using Boost for an application and some members have
expressed concern over the performance of Boost serialization because a
stack dump showed an excess of 100+ calls for a simple example shown below.
Is there a good resource that shows the relative performance of Boost
serializations?

 

Code example: (Windows XP, MSVS 2003) Around 389 bytes where serialized.

 

**example: (it's not pretty but it gets the job done)

void save_schedule(const bus_schedule &s, const char * filename)

{
    std::ostringstream ss(std::ios::binary); // make an
archive
    std::ofstream ofs("perf.txt"); // output
file
    LARGE_INTEGER start, finish, diff, frequency; // windows junk
    double duration; //
duration
    char buff[256];

 

    // adjust priority so high no one can interrupt!

    SetThreadPriority( GetCurrentThread() ,THREAD_PRIORITY_TIME_CRITICAL );

 

    // perform timed test

    QueryPerformanceCounter(&start);
    boost::archive::binary_oarchive oa(ss);
    oa << s;
    QueryPerformanceCounter(&finish);

    QueryPerformanceFrequency(&frequency);

    // compute results

    diff.QuadPart = finish.QuadPart - start.QuadPart;
    duration = ((double)diff.QuadPart)/(frequency.QuadPart) ;
    sprintf( buff, "%f seconds\n", duration );
    ofs<<buff;
}

 

**results:

debug: 0.001636 seconds

release: 0.000712 seconds

 

Thanks in advance for an assistance.

 

Graham

 

 



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net