Skip to content

Instantly share code, notes, and snippets.

@lomereiter
Created December 20, 2012 20:13
Show Gist options
  • Save lomereiter/4348173 to your computer and use it in GitHub Desktop.
Save lomereiter/4348173 to your computer and use it in GitHub Desktop.
D: vector operation vs manual loop
...
movl $239, %edi
movq %r14, %rsi
movl $1, %edx
callq _arrayExpSliceAddass_k
...
LBB0_14:
xorl %eax, %eax
.align 16, 0x90
.LBB0_15:
incl 64(%rsp,%rax,4)
incq %rax
cmpq $239, %rax
jne .LBB0_15
import std.datetime;
import std.stdio;
void main() {
StopWatch sw;
uint[1024] array;
for (size_t k = 0; k < 15; k++)
{
array[] = 0;
sw.start();
for (size_t i = 0; i < 1000; i++)
array[0 .. 239] += 1;
sw.stop();
write(sw.peek().usecs, "\t");
array[] = 0;
sw.reset();
sw.start();
for (size_t i = 0; i < 1000; i++)
for (size_t j = 0; j < 239; j++)
array[j] += 1;
sw.stop();
writeln(sw.peek().usecs);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment