Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: why is (F) about twice as fast as print -l ?



On Sun, Feb 5, 2023 at 8:15 PM sergio <sergio@xxxxxxxxxxxxx> wrote:
>
> l=({1..100000000})

${(F)l} joins this huge array into a single string and then that
single argument is passed to "print".

print -l $l expands the array and passes all those words to "print",
requiring that they individually be copied at least one extra time.

Incidentally,
  print -aC1 $l
is even slower, but
  printf "%s\n" $l
is about the same as print -l.




Messages sorted by: Reverse Date, Date, Thread, Author