Skip to content
Prev 12448 / 63461 Next

optim-Bug (PR#6720)

Prof Brian Ripley <ripley@stats.ox.ac.uk> writes:
...
I had planned to suggest that we use memset more widely and perhaps
add a macro Memset, defined like the current Memcpy, to R_ext/RS.h.  I
felt that memset was likely to be more efficient for zeroing large
areas of memory than running a loop would be.  Recently Peter Dalgaard
and Andy Liaw and I discussed this with regard to a test to see if
vectors using more than 4 GB of memory could be allocated on an
Opteron.  Andy installed my suggested modification to do_makevector to
use memset for zeroing freshly allocated vectors and found that the
running time for a test on an Opteron/Linux system actually increased.
It appears that, at least on that system, memset runs a loop at the
level of characters.

I still think it would be a good idea to use memset but we would want
to do some timing comparisons to make sure we don't slow things down.