Boost logo

Ublas :

From: Stefan Tarrant (stefan.tarrant_at_[hidden])
Date: 2005-06-01 08:52:36


I don't find that at all, in fact I find it takes over 100x longer to run
the test code for valarray as opposed to the ublas vector.

I am also running VC++ 7.1, on a P4 3.2GHz. I have attached my test program.

The output that I get is:

15.046
0.11
Press any key to continue

It takes about 15 sec to run with a valarray, and 0.11 sec with a ublas
vector.

Stefan

-----Original Message-----
From: ublas-bounces_at_[hidden]
[mailto:ublas-bounces_at_[hidden]]On Behalf Of christopher diggins
Sent: Tuesday, May 31, 2005 4:54 PM
To: ublas_at_[hidden]
Subject: [ublas] Performance concerns

Vector addition/subtraction for ublas::vector takes 9x to 80x times as long
to execute (for vectors from size 1024 to size 2) as std::valarray on my
system (Visual C++ 7.1, release build, default optimizations) any reason for
this?

Here is the code:

  template<int iterations, class vector_T>
  void arithmetic_benchmark(vector_T& v)
  {
    {
      reporting_timer t;
      vector_T tmp = v;
      for (int i=0; i < iterations; i++) {
        tmp += v;
        tmp -= v;
      }
    }
  }

Also even for simple element access the performance is several times slower.
I can share my code if needed.

Christopher Diggins
http://www.cdiggins.com

_______________________________________________
ublas mailing list
ublas_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/ublas