zsh-users
 help / color / mirror / code / Atom feed
From: Ray Andrews <rayandrews@eastlink.ca>
To: zsh-users@zsh.org
Subject: Re: The elements of enlightenment
Date: Mon, 5 Dec 2022 15:52:47 -0800	[thread overview]
Message-ID: <37b2456f-0459-4b85-74d1-bb380715e2ed@eastlink.ca> (raw)
In-Reply-To: <CAN=4vMq7=BGygpKU4ed_b33tdE0NGoCALZdaF10hz0co4zqksQ@mail.gmail.com>


On 2022-12-05 13:49, Roman Perepelitsa wrote:
> That's why I tried to quantify it in related terms: on my machine
> executing that thing 100 times takes over a second.
>
>      % time ( repeat 100 var=$(printf hello) )
>      user=0.00s system=1.06s cpu=90% total=1.178

>      for k v in ${(kv)options}; do
> 	# 100X slower!!!
> 	#list+=$( printf '%-20s %s%s\e[0m\n' $k ${color[$v]} $v )
> 	printf -v line '%-20s %s%s\e[0m' $k ${color[$v]} $v
> 	list+="$line"
>      done
>
Even buried back in the entire function, where the difference is 
somewhat swamped by the time the other code takes to run,  it's still 
100X faster doing it your way.  Sheesh, it's quite astonishing. I 
probably wouldn't understand the answer anyway but I hafta wonder why 
this forking is so necessary.  But for now 'print -v var' is my new friend.




  reply	other threads:[~2022-12-05 23:53 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-05 15:57 Ray Andrews
2022-12-05 16:24 ` Roman Perepelitsa
2022-12-05 18:30   ` Bart Schaefer
2022-12-05 19:35   ` Ray Andrews
2022-12-05 19:44     ` Bart Schaefer
2022-12-05 19:58     ` Roman Perepelitsa
2022-12-05 21:20       ` Ray Andrews
2022-12-05 21:49         ` Roman Perepelitsa
2022-12-05 23:52           ` Ray Andrews [this message]
2022-12-06  0:17             ` Bart Schaefer
2022-12-06  1:34               ` Ray Andrews
2022-12-06 18:55             ` Roman Perepelitsa
2022-12-06 19:45               ` Bart Schaefer
2022-12-06 20:01                 ` Roman Perepelitsa
2022-12-06 20:07                   ` Bart Schaefer
2022-12-06 20:22                     ` Roman Perepelitsa
2022-12-06 23:52               ` Lawrence Velázquez
2022-12-07  1:04                 ` Lawrence Velázquez
2022-12-05 21:49         ` Bart Schaefer
2022-12-05 21:51           ` Bart Schaefer
2022-12-05 22:24           ` Ray Andrews
2022-12-05 23:24             ` Bart Schaefer
2022-12-06  1:47               ` Ray Andrews
2022-12-06  6:39 ` Lawrence Velázquez

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=37b2456f-0459-4b85-74d1-bb380715e2ed@eastlink.ca \
    --to=rayandrews@eastlink.ca \
    --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).