% Reductions with fused loaders, 300 times over 10 million elements: % dot, norm and max each read their operands exactly once per pass -- % sum(a.*b) is one sweep of memory, not two. n = 10000000; reps = 300; a = rand(n, 1); b = rand(n, 1); tic; for k = 1:reps d = dot(a, b); nrm = norm(a - b); mx = max(abs(a - b)); end t = toc; fprintf('dot %.0f norm %.2f max %.6f\n', d, nrm, mx); fprintf('%.1f GB/s effective\n', reps*6*n*4/1e9/t);