Tips: Copying Memory

VideoToolbox
PsychToolbox
Tips
 
speed
displays
how to
mac software
bibliographies


COPYING MEMORY TO VIDEO MEMORY
BlockMoveData() is VERY SLOW (about 2 MB/s) if you move to a video buffer. The Developer release notes for the 9500 explain that video buffers are uncacheable and that BlockMoveData() uses an instruction that copes badly with that situation. The notes suggest using BlockMoveDataUncached() instead. It's good advice.

COPYING MEMORY TO MEMORY
I seem to recall reading somewhere that one could do faster moves on the PowerPCs by using floating-point register pointers. However, TimeCPU timings show that the PowerPCs move memory at the SAME speed (in bytes/s) whether one moves longs, floats, or doubles. And BlockMoveData() is significantly faster.

PowerMac 9500/120, ppc604, L2 cache, System 7.52.
BlockMove(); // 24 MB/s
BlockMoveData(); // 35 MB/s
*paF++=*pbF++; // long, float, or double, memory to memory, 30 MB/s

PowerMac 8500/120, ppc604, L2 cache, System 7.52.
BlockMove(); // 25 MB/s
BlockMoveData(); // 29 MB/s
BlockMoveData(); // mem.to vid.mem. 5 MB/s
*paF++=*pbF++; // long, float, or double, memory to memory, 24 MB/s
*paL++=*pbL++; // long, memory to video mem. 22 MB/s

PowerMac 7500/100, ppc601, System 7.52.
BlockMove(); // 21 MB/s
BlockMoveData(); // 28 MB/s
BlockMoveData(); // mem.to vid.mem. 3 MB/s
*paF++=*pbF++; // long, float, or double, memory to memory, 19 MB/s
*paL++=*pbL++; // long, memory to video mem. 26 MB/s

PowerMac 7200/90, ppc601, System 7.52.
(Another 7200/90 was 20% faster.)
BlockMove(); // 18 MB/s
BlockMoveData(); // 19 MB/s
BlockMoveData(); // mem.to vid.mem. 2 MB/s
*paF++=*pbF++; // long, float, or double, memory to memory, 14 MB/s
*paL++=*pbL++; // long, memory to video mem. 12 MB/s

PowerMac 6100/60, ppc601, System 7.51.
BlockMove(); // 22 MB/s
BlockMoveData(); // 28 MB/s
BlockMoveData(); // mem.to vid.mem. 2 MB/s
*paF++=*pbF++; // long, float, or double, memory to memory, 22 MB/s
*paL++=*pbL++; // long, memory to video mem. 12 MB/s

Thanks to:
Kevin Te Strake, ktestrake@madison.k12.wi.us
Mike Heersche, mikehe@mcs.com
Paul Gorski, pgorski@infi.net
John Auborn, auborn@owens.ridgecrest.ca.us
Peter Warrick, padishar@indirect.com