Boost logo

Boost :

From: Andy (atompkins_at_[hidden])
Date: 2007-05-30 10:01:29

"Christian Henning" <chhenning_at_[hidden]> wrote in

> I like the way you circumvent the license problem. Rewriting. Cool

Thanks :)

> One question. One person reported that the uuid lib was quite slow in
> comparison to C# for instance. Could you resolve that, too?

I did optimize the random-based create function. It, of course, does
depend on the random number generator used.

The uuid::create(engine) (using mt19937) is now a little faster then
.NET's. For 10,000,000 calls to uuid::create(engine), I get 3.937s, and
for .NET's Guid::NewGuid(), I get 4.375s.

The name-based uuid::create function has not been optimized.

Here are the tests I used:

#include "stdafx.h"
#using <mscorlib.dll>
using namespace System;

int _tmain()
    const int N = 10000000;
    DateTime t0 = DateTime::Now;
        for (int i = 0; i < N; i++) {
    TimeSpan ts = DateTime::Now - t0;

    return 0;


#include <boost\progress.hpp>
#include <boost\uuid.hpp>
#include <iostream>
#include <boost/random.hpp>

int main(int argc, char* argv[])
    using namespace boost;
    const int N = 10000000;
    mt19937 engine;
    timer t1;

    for (int i=0; i<N; ++i) {

    std::cout << t1.elapsed() << '\n';

    return 0;

> Thanks for your great work,
> Christian

< snip >


Boost list run by bdawes at, gregod at, cpdaniel at, john at