Boost logo

Ublas :

From: christopher diggins (cdiggins_at_[hidden])
Date: 2005-05-31 14:23:54

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

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