zsh-workers
 help / color / mirror / code / Atom feed
From: "Daniel Shahaf" <d.s@daniel.shahaf.name>
To: zsh-workers@zsh.org
Subject: Re: [BUG] zformat -f has no multibyte support
Date: Thu, 26 Dec 2019 11:28:50 +0000	[thread overview]
Message-ID: <cb609ef2-ead0-4db8-9cc9-c81cafb6210e@www.fastmail.com> (raw)
In-Reply-To: <027d3c24-e3d1-4cfd-8c3e-5221998a327f@www.fastmail.com>

Daniel Shahaf wrote on Thu, 26 Dec 2019 05:04 +00:00:
> dana wrote on Thu, 26 Dec 2019 04:35 +00:00:
> > On 24 Dec 2019, at 14:23, Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> > > Actually, I don't suppose we could just call into the printf code directly, can
> > > we?  It _works_ (see attachment), but it's not elegant.
> > 
> > A very quick before/after test shows that it reduces performance quite a bit,
> > especially as the number of format specs increases. Admittedly, it's only a
> > few µs per spec in absolute numbers (at least on my Mac, with the handful of
> > operations i tested),
> 
> What is the _factor_ of slowdown?  (Multiplicative, as opposed to additive)
> I.e., does the patch make things slower by 1%, or 10%, or 100%, or 1000%?

According to dana and I's results, the factor is between x4 and x29:

[[[
% for 1 in */Src/zsh; do printf "%-16s%s\n" $1:h:h $($1 -fc 'time ( zformat -f x ${(r.1000000..%a.):-} a:o )'); done
( zformat -f x ${(r.1000000..%a.):-} a:o; )  0.10s user 0.27s system 99% cpu 0.369 total
master          
( zformat -f x ${(r.1000000..%a.):-} a:o; )  1.04s user 0.33s system 99% cpu 1.372 total
patch           
]]]

[[[
# Without patch
[DEV] zsh % repeat 5 utime zformat -f x ${(r.10000..%a.):-} a:o
[429 µs]
[507 µs]
[499 µs]
[468 µs]
[609 µs]

# With patch
[DEV] zsh % repeat 5 utime zformat -f x ${(r.10000..%a.):-} a:o
[16577 µs]
[14063 µs]
[13941 µs]
[13972 µs]
[13569 µs]
]]]

I don't know how to explain the difference (we've both had other things to look into).


      reply	other threads:[~2019-12-26 11:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-23 22:24 zsugabubus
2019-12-24 20:23 ` Daniel Shahaf
2019-12-26  4:35   ` dana
2019-12-26  5:04     ` Daniel Shahaf
2019-12-26 11:28       ` Daniel Shahaf [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=cb609ef2-ead0-4db8-9cc9-c81cafb6210e@www.fastmail.com \
    --to=d.s@daniel.shahaf.name \
    --cc=zsh-workers@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).