toon-members
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Toon-members] Should dynamic really be this slow?


From: Georg Klein
Subject: [Toon-members] Should dynamic really be this slow?
Date: Wed, 20 Jun 2007 18:35:19 +0100 (BST)

I was surprised by this:

static.cc:
#include <TooN/numerics.h>
#include <TooN/helpers.h>
int main()
{
  Vector<2> v2;  Zero(v2);
  Matrix<2> m2;  Identity(m2);
  Vector<3> v3((double[]){1.0,1.0,1.0});
  for(int i=0; i<100000000; i++)
      v2 += m2 * v3.slice<0,2>();
  return v2[0];
}

compiling with O3 and running this on my machine takes 0.27 seconds. Pretty cool.

If however I chance the crunchy line to
v2 += m2 * v3.slice(0,2);

it takes 4.3 seconds. That's 16 times slower. That's a lot! Can anyone reproduce this? Compiling with -DNDEBUG to get rid of the assert makes hardly any difference.







reply via email to

[Prev in Thread] Current Thread [Next in Thread]