Question: Why is zip slower than `~`?

For two nonempty lists (of the same length), 

F~(list1, ` $`, list2); # space-dollarsign

is (almost) equivalent to 

zip(F, list1, list2);

However, it appears that in practice, using `~` can be faster than its equivalent zip version.
Here is a typical test: 

restart;

x := combinat:-randperm(10^7):
y := combinat:-randperm(10^7):

undefine(f);

t2 := CodeTools[Usage](`~`[f](x, ` $`, y), iterations = 10)

memory used=0.62GiB, alloc change=1.21GiB, cpu time=51.35s, real time=14.77s, gc time=42.55s

 

t4 := CodeTools[Usage](zip(f, x, y), iterations = 10)

memory used=0.52GiB, alloc change=-4.00MiB, cpu time=53.88s, real time=16.25s, gc time=44.51s

 

evalb(t2 = t4)

true

(1)

NULL


 

Download `~`_and_zip.mw

But I cannot find any explanations in the documentation (as well as What is Maple's equivalent to Mathematica's MapThread?). Does anyone know why?

Please Wait...