git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: apodtele <apodtele@gmail.com>
To: git@vger.kernel.org
Subject: Re: [PATCH 3/3] diff --stat: sometimes use non-linear scaling.
Date: Thu, 12 Oct 2006 11:04:35 -0400	[thread overview]
Message-ID: <d620685f0610120804l59c38e07uf7b624b2a0026aea@mail.gmail.com> (raw)

Sublinear solution without patch is below.

On Sept 28, 2006 Martin Waitz wrote:
> On Wed, Sep 27, 2006 at 08:12:49AM -0700, Linus Torvalds wrote:
>> No _way_ is it correct to show more than three characters if there were
>> three lines of changes.
>>
>> I think "nonlinear" is fine, but this is something that is "superlinear"
>> in small changes, and then sublinear in bigger ones (and then apparently
>> totally wrong for one-line changes).
>>
>> It should at least never be superlinear, I believe.
>
> So if we want to keep the logarithmic scale we can do some maths:
> Assume we use a formula ala
>         length = a log(change + b) + c

You are probably looking for much simpler, log-less, and pure integer:

        length = width * change / (width + change) + 1

Assuming target witdth of 40, for example, it will produce

Change    Length
1         1
2         2
3         3
4         4
10        9
20        14
30        18
50        23
100       29
1000      39
10000     40
1000000   40

--
Alexei

             reply	other threads:[~2006-10-12 15:04 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-12 15:04 apodtele [this message]
  -- strict thread matches above, loose matches on Subject: below --
2006-09-27  2:40 [PATCH 3/3] diff --stat: sometimes use non-linear scaling Junio C Hamano
2006-09-27  3:11 ` David Rientjes
2006-09-27  5:09   ` Junio C Hamano
2006-09-27  5:32     ` David Rientjes
2006-09-27  6:19       ` Junio C Hamano
2006-09-27  6:49         ` David Rientjes
2006-09-27  7:05           ` Junio C Hamano
2006-09-27  7:19             ` David Rientjes
2006-09-27  7:50               ` Johannes Schindelin
     [not found]                 ` <BAYC1-PASMTP024D1DA4730F9DF93F857FAE1A0@CEZ.ICE>
2006-09-27  8:35                   ` Johannes Schindelin
     [not found]                     ` <20060927044112.cc170405.seanlkml@sympatico.ca>
2006-09-27  8:41                       ` Sean
2006-10-06 15:53                 ` Petr Baudis
2006-09-27  7:36 ` Johannes Schindelin
2006-09-27  9:16 ` Martin Waitz
2006-09-27 15:12 ` Linus Torvalds
2006-09-28  8:17   ` Martin Waitz
2006-09-28  9:20     ` Junio C Hamano
2006-09-29 10:56       ` Andreas Ericsson

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=d620685f0610120804l59c38e07uf7b624b2a0026aea@mail.gmail.com \
    --to=apodtele@gmail.com \
    --cc=git@vger.kernel.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.
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).