Boost logo

Boost :

From: Arkadiy Vertleyb (vertleyb_at_[hidden])
Date: 2005-10-08 05:36:29


"Calum Grant" <calum_at_[hidden]> wrote

> Here is the output on my 1.7GHz laptop:
>
> 1000000
> ((0),(0))
> ((1),(1))
> ((2),(2))
> ((3),(3))
> ((4),(4))
> ((5),(5))
> ((6),(6))
> ((7),(7))
> ((8),(8))
> ((9),(9))
> Total 10 results
> 2000000
> That took just 1687ms
^^^^^^^^^^^^^^^^^^^
> Press any key to continue

These results are so unbelievably impressive, that I had to see them with my
own eyes. So I downloaded your library from http://visula.org/relational.
My PS has a 1.5 Ghz processor, and I used VC71 public edition (no
optimization), release mode.

 Unfortunately my results were slightly different from yours:

1000000
((0),(0))
((1),(1))
((2),(2))
((3),(3))
((4),(4))
((5),(5))
((6),(6))
((7),(7))
((8),(8))
((9),(9))
Total 10 results
2000000
That took just 35453ms
^^^^^^^^^^^^^^^^^^
Press any key to continue

This is a little less impressive :-(

What am I missing?

Regards,
Arkadiy

PS: The RTL (after modifications I mentioned before) was more than twice
faster:

1000000 records added
2000000 records added
That took just 14906ms
^^^^^^^^^^^^^^^^^^
Press any key to continue

Here is the modified text (again, I am using current Boost CVS):

#include <table_delta.hpp>
#include <utils.hpp>
#include <selection_delta.hpp>
#include <key_index_delta.hpp>
#include <crossproduct_delta.hpp>
#include <rename_delta.hpp>
#include <boost/lambda/lambda.hpp>
#include <boost/typeof/typeof.hpp>
#include <expression_registry.hpp>
#include <transaction.hpp>
#include <cstdlib>
#include <merge_delta.hpp>
#include <windows.h>
#include <ctime>

using namespace boost;
using namespace boost::lambda;

BOOST_RTL_DEFINE_COLUMN(int, c1);

struct my_info : rel::table_info<
    mpl::vector<c1>
>{};

typedef rel::table<my_info> my_table;
typedef my_table::value_type my_tuple;

struct a;
typedef rel::alias<c1, a> c2;

main()
{
    using namespace std;

    clock_t t0 = clock();

    my_table t;

    t.reserve(2000000);

    int i;

    for (i = 0; i < 1000000; ++i)
        t.insert(my_tuple(i + 1));

    BOOST_AUTO(t2, rel::auto_rename<a>(t));

    BOOST_AUTO(mr, rel::merge<1>(t, t2));

    cout << count(mr) << " records added" << endl;

    for (; i < 2000000; ++i)
        t.insert(my_tuple(i + 1));

    cout << count(mr) << " records added" << endl;

    clock_t t1 = clock();

    std::cout << "That took just " << (1000*(t1-t0))/CLOCKS_PER_SEC <<
"ms\n";

    return 0;
}


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk