{"thread":{"id":"5903","subject":"Re: [PATCH 3/3] diff --stat: sometimes use non-linear scaling.","startedAt":"2006-10-12T15:04:35Z","lastAt":"2006-10-12T15:04:35Z","messageCount":1,"participants":["apodtele"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"28668","messageId":"d620685f0610120804l59c38e07uf7b624b2a0026aea@mail.gmail.com","threadId":"5903","inReplyTo":null,"subject":"Re: [PATCH 3/3] diff --stat: sometimes use non-linear scaling.","fromName":"apodtele","fromEmail":"apodtele@gmail.com","sentAt":"2006-10-12T15:04:35Z","receivedAt":"2006-10-12T15:04:35Z","isPatch":true,"sender":{"key":"apodtele@gmail.com","avatar":null},"body":"Sublinear solution without patch is below.\n\nOn Sept 28, 2006 Martin Waitz wrote:\n> On Wed, Sep 27, 2006 at 08:12:49AM -0700, Linus Torvalds wrote:\n>> No _way_ is it correct to show more than three characters if there were\n>> three lines of changes.\n>>\n>> I think \"nonlinear\" is fine, but this is something that is \"superlinear\"\n>> in small changes, and then sublinear in bigger ones (and then apparently\n>> totally wrong for one-line changes).\n>>\n>> It should at least never be superlinear, I believe.\n>\n> So if we want to keep the logarithmic scale we can do some maths:\n> Assume we use a formula ala\n>         length = a log(change + b) + c\n\nYou are probably looking for much simpler, log-less, and pure integer:\n\n        length = width * change / (width + change) + 1\n\nAssuming target witdth of 40, for example, it will produce\n\nChange    Length\n1         1\n2         2\n3         3\n4         4\n10        9\n20        14\n30        18\n50        23\n100       29\n1000      39\n10000     40\n1000000   40\n\n--\nAlexei\n"}]}