zsh-users
 help / color / mirror / code / Atom feed
From: Ray Andrews <rayandrews@eastlink.ca>
To: zsh-users@zsh.org
Subject: Re: zsh functions not playing nice.
Date: Sat, 19 Jan 2013 10:53:10 -0800	[thread overview]
Message-ID: <50FAEB96.3000205@eastlink.ca> (raw)
In-Reply-To: <20130119173807.GB7039@chaz.gmail.com>

On 19/01/13 09:38 AM, Stephane Chazelas wrote:


Thanks. This is a bit over my head but I get some idea.
>
> ~$ type nice
> nice is /usr/bin/nice
>
> There's no way it can know about a zsh function which is
> something internal to the shell.
>
> It *executes* a command. So what you think is a builtin is
> the command version of it in /bin or /usr/bin:
Yes, so I see.
> ~$ strace -fe execve nice echo test
> execve("/bin/echo", ["echo", "test"], [/* 40 vars */]) = 0
>
> What you could do is:
>
> some-zsh-function & renice $!; fg
>
> Note that it would run that function in a subshell.
>
What I'm experimenting with is some way to get consistent run times for
various functions that I'm writing, so as to optimize them. It's quite 
educational.
But the runtimes vary hugely so it's hard to say if any given change has 
had a
positive effect.  I was thinking that if I set the niceness to maximum,
then maybe the times would smooth out since other processes would be 
less likely to
interfere.

Looking at the above, what I'm now doing is just:

   renice -n -20 -u root

... and then just running the function normally. It sure makes things go 
faster,
and it does smooth the runtimes out a bit, tho not perfectly.


  reply	other threads:[~2013-01-19 19:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-19 16:58 Ray Andrews
2013-01-19 17:38 ` Stephane Chazelas
2013-01-19 18:53   ` Ray Andrews [this message]
2013-01-19 17:51 ` Russell Harmon

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=50FAEB96.3000205@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).