zsh-workers
 help / color / mirror / code / Atom feed
From: "Andrej Borsenkow" <borsenkow.msk@sni.de>
To: "ZSH workers mailing list" <zsh-workers@sunsite.auc.dk>
Subject: Speed of ZSH
Date: Fri, 21 May 1999 12:11:59 +0400	[thread overview]
Message-ID: <001a01bea361$994a2140$21c9ca95@mow.siemens.ru> (raw)

I recently needed to do a quick prototyping, and selected zsh just for the
easy programming. The task was: I get a file with records of length 2040
characters and need to extract several (~100) fixed width fields and write
them out separated by tabs. I had a list of fields in the form n1-n2, so I
just vi'ed them :-) to get $line[n1,n2].

The problems I got were:

1. I found, that it is near to impossible to ``read'' line without breaking
it on IFS. ``read -k'' did not work :-( After some play I found, that
unsetting IFS helps - not very nice. How useful would it be to add a flag
that says "read entire line in scalar variable without splitting"?

2. It is impossible to ``print'' arguments separated by user defined string
(only NL or NUL). I had to make an array out of fields, and then print it
with explicit join:

fields=( $line[n1,n2] ...)
print ${(j/\t/)fields}

(Aside: how useful would it be to add flag to ``print'' to define
separator?)

After doing it I found, that ZSH needs several seconds for a file with 28
records! That is really too much for such a simple task. I suspect, the
reason is constant reallocation of memory when first array is created
(remember, it has about 100 elements) and then when it is joined.

If anybody interested, I could recompile with profiling.

I don't use zsh-mem mostly because I don't understand, what it actually is
:-)

/andrej


             reply	other threads:[~1999-05-21  8:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-05-21  8:11 Andrej Borsenkow [this message]
1999-05-21 10:18 ` Bart Schaefer

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='001a01bea361$994a2140$21c9ca95@mow.siemens.ru' \
    --to=borsenkow.msk@sni.de \
    --cc=zsh-workers@sunsite.auc.dk \
    /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).