On Tuesday, 28 October 2014 at 16:07:38 UTC, MachineCode wrote:
I'm very surprise. If they either equal or fast sometimes the
compiler did great optizations or it's just a multicore
processor that's helping or what else? the first version (from
your post, the one using ranges) change in each iteration two
pointers (in pop*() calls) and request r's length 3 times (in
.empty calls) while the second doesn't, just run until an
already know index (when enter in the loop) and access two
index in each iteration. This without consider the amount of
ifs.
I don't know, maybe I just thinking in the C-way as that code
would run.
Yes, I'm curious about this too. I will check the assembly output
later (When I have free time) to understand what is happening and
why popFront/Back are faster than a loop.
Matheus.