From: Jonathan Nieder <jrnieder@gmail.com>
To: Antoine Pelisse <apelisse@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: [PATCH 1/2] strbuf: create strbuf_humanize() to show byte sizes
Date: Wed, 10 Apr 2013 12:43:07 -0700 [thread overview]
Message-ID: <20130410194307.GA27070@google.com> (raw)
In-Reply-To: <1365620604-17851-1-git-send-email-apelisse@gmail.com>
Antoine Pelisse wrote:
> Separate text formatting from size simplification and make the function
> public in strbuf so that it can easily be used by other clients.
>
> We now can use strbuf_humanize() for both downloaded size and download
> speed calculation.
Sounds like a good thing to do.
> One of the drawbacks is that speed will now look like
> this when download is stalled: "0 bytes/s" instead of "0 KiB/s".
At first glance that is neither obviously a benefit nor obviously a
drawback. Can you spell this out more?
> --- a/Documentation/technical/api-strbuf.txt
> +++ b/Documentation/technical/api-strbuf.txt
> @@ -230,6 +230,11 @@ which can be used by the programmer of the callback as she sees fit.
> destination. This is useful for literal data to be fed to either
> strbuf_expand or to the *printf family of functions.
>
> +`strbuf_humanize`::
> +
> + Append the given byte size as a human-readable string (i.e. 12.23 KiB,
> + 3.50 MiB).
Based on the function name alone, it is not easy to guess what it will
do (e.g., maybe it will paraphrase 3 to "three" and 10000000 to
"enormous"). How about something like strbuf_filesize?
If I understand the code correctly, this jumps units each time it
exceeds 1.0 of the next unit (bytes, KiB, MiB, GiB), which sounds like
a fine behavior.
Hope that helps,
Jonathan
next prev parent reply other threads:[~2013-04-10 19:43 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-02 11:43 [PATCH] count-objects: output "KiB" instead of "kilobytes" Mihai Capotă
2013-04-02 17:41 ` Junio C Hamano
2013-04-02 22:01 ` Junio C Hamano
2013-04-03 6:27 ` Mihai Capotă
2013-04-03 12:48 ` [PATCH v2] " Mihai Capotă
2013-04-03 14:38 ` Junio C Hamano
2013-04-04 13:18 ` Mihai Capotă
2013-04-04 16:27 ` Junio C Hamano
2013-04-05 9:38 ` Mihai Capotă
2013-04-05 9:39 ` [PATCH] count-objects doc: document use of kibibytes Mihai Capotă
2013-04-05 20:31 ` [PATCH v2] count-objects: output "KiB" instead of "kilobytes" Antoine Pelisse
2013-04-08 18:18 ` [PATCH 1/2] progress: create public humanize() to show sizes Antoine Pelisse
2013-04-08 18:18 ` [PATCH 2/2] count-objects: add -H option to humanize sizes Antoine Pelisse
2013-04-08 21:40 ` [PATCH 1/2] progress: create public humanize() to show sizes Junio C Hamano
2013-04-10 19:03 ` [PATCH 1/2] strbuf: create strbuf_humanize() to show byte sizes Antoine Pelisse
2013-04-10 19:03 ` [PATCH 2/2] count-objects: add -H option to humanize sizes Antoine Pelisse
2013-04-10 19:43 ` Jonathan Nieder [this message]
2013-04-10 20:00 ` [PATCH 1/2] strbuf: create strbuf_humanize() to show byte sizes Antoine Pelisse
2013-04-10 19:57 ` Junio C Hamano
2013-04-10 20:12 ` Antoine Pelisse
2013-04-08 21:55 ` [PATCH 1/2] progress: create public humanize() to show sizes Eric Sunshine
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=20130410194307.GA27070@google.com \
--to=jrnieder@gmail.com \
--cc=apelisse@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/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.
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).