[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: I'll try again: oct and arrays
From: |
Jordi Gutiérrez Hermoso |
Subject: |
Re: I'll try again: oct and arrays |
Date: |
Wed, 29 Dec 2010 08:12:53 -0600 |
On 29 December 2010 07:34, Jesper Schmidt Hansen
<address@hidden> wrote:
> I think the difference is due to the fact that there exists an
> overhead using the () operator (not inlined by the compiler I guess),
How are you compiling, which compiler? And yes, from a quick glance
at Octave's source code, op() does more than just return the element
you want, even if you turn off bounds checking (for example, it calls
make_unique). It's not the call stack that makes op() that is giving
you a few extra centiseconds; that overhead is epsilonic in moderrn
computers, but rather the fact that op() simply does a few more
operations, including adjusting a few reference counters.
Also, this is a rather artificial example. There is a sum function
that calls your underlying BLAS library precisely for reasons like
this (yes, vectorisation is an important technique even for C++
sources). Do you have another case where op() is giving you an
unacceptable speed penalty?
- Jordi G. H.