From: Bart Schaefer <schaefer@brasslantern.com>
To: sergio <sergio@outerface.net>
Cc: zsh-users@zsh.org
Subject: Re: why is (F) about twice as fast as print -l ?
Date: Sun, 5 Feb 2023 21:03:59 -0800 [thread overview]
Message-ID: <CAH+w=7Z+mAZTnYgJSkm+jsFJWYSyKa1uBEvB-FrWhoTvBf8yDg@mail.gmail.com> (raw)
In-Reply-To: <e0c80c2f-313a-8412-83b2-973c0800e60e@outerface.net>
On Sun, Feb 5, 2023 at 8:15 PM sergio <sergio@outerface.net> 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.
prev parent reply other threads:[~2023-02-06 5:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-06 4:15 sergio
2023-02-06 5:03 ` Bart Schaefer [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAH+w=7Z+mAZTnYgJSkm+jsFJWYSyKa1uBEvB-FrWhoTvBf8yDg@mail.gmail.com' \
--to=schaefer@brasslantern.com \
--cc=sergio@outerface.net \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).