|
From: | John W. Eaton |
Subject: | Re: Using memcpy or memmove instead of for loop in liboctave/array/dim-vector.h |
Date: | Sat, 09 Nov 2013 12:00:52 -0500 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130116 Icedove/10.0.12 |
On 11/09/2013 05:28 AM, c. wrote:
On 9 Nov 2013, at 04:57, PrasannaKumar Muralidharan<address@hidden> wrote:Hi Octave maintainers, In liboctave/array/dim-vector.h clonerep and resizerep functions are defined. They use for loop for copying data. Is it possible to use memcpy or memmove instead? The mem* function may be faster than for loop as its implementation can use SIMD instructions when possible. Will it be useful or does it make sense? Thanks and Regards, PrasannaKumarI doubt this would make a huge difference in performance for any application as dim_vector objects have the size of the number of dimensions in an array, which is usually a small number.
Yes, nearly always just 2 or 3 dimensions plus the reference count and number of dimensions (they are all stored together in the same array). So I doubt that changing the way this copy is done will make much difference.
I personally think it would look cleaner to use C++ style functions like std::copy and std::move rather than the C equivalents, though. I don't see an rule about this in the coding standard, is there a preference for using either C or C++ standard library functions?
Yes, C++ library functions are usually preferred over calling C library functions directly.
jwe
[Prev in Thread] | Current Thread | [Next in Thread] |