zsh-users
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: Zsh Users <zsh-users@zsh.org>
Subject: Re: efficiency
Date: Sat, 4 Feb 2017 15:47:36 +0000	[thread overview]
Message-ID: <20170204154736.5a51b119@ntlworld.com> (raw)
In-Reply-To: <b4694706-05cd-de8d-368e-239f3c2ace8d@eastlink.ca>

On Sat, 04 Feb 2017 07:39:28 -0800
Ray Andrews <rayandrews@eastlink.ca> wrote:
> I think what I was really asking is if, in an interpreted language the 
> time spent calculating is offset by the time spent parsing.  That is, in 
> C you'd be more efficient doing the calculation once (besides what you 
> say above), but maybe in zsh the important thing is to reduce the number 
> of lines or the number of variables or something like that.  Or, on the 
> contrary, maybe the simpler form is doubly better since the lines are 
> shorter and thus save parsing time as well as calculation time.

Typically, in a real script, you'd find the difference in time made so
little difference having it look neat was preferable.  You'd only start
looking at optimisations if this was in an inner loop and had to run
many times; or was in a function that lots of users had to run very many
times a day; or involved a significantly larger amount of data if done
one way rather than the other; or something like that.

I'm sure this has come up before, but if you're in a position where a
saving of this kind is important, there's a good chance you shouldn't
really be using a shell at all.

pws


  reply	other threads:[~2017-02-04 15:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-04  2:55 efficiency Ray Andrews
2017-02-04 15:05 ` efficiency Peter Stephenson
2017-02-04 15:39   ` efficiency Ray Andrews
2017-02-04 15:47     ` Peter Stephenson [this message]
2017-02-04 16:38       ` efficiency Ray Andrews
2017-02-04 16:47         ` efficiency Peter Stephenson
2017-02-04 17:39           ` efficiency Ray Andrews

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=20170204154736.5a51b119@ntlworld.com \
    --to=p.w.stephenson@ntlworld.com \
    --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).