git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 3/3] diff --stat: sometimes use non-linear scaling.

From
Aapodtele <apodtele@gmail.com>
Date
Oct 12, 2006, 15:04 UTC
Message-ID
<d620685f0610120804l59c38e07uf7b624b2a0026aea@mail.gmail.com>
Sublinear solution without patch is below.
On Sept 28, 2006 Martin Waitz wrote:
Show 13 quoted lines
> 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

Message 1 of 1 in “Re: [PATCH 3/3] diff --stat: sometimes use non-linear scaling.”
  1. apodteleOct 12, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.