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

Re: [PATCH 1/2] diff --stat: use asymptotic scaling in graph

From
Andy Whitcroft <apw@shadowen.org>
Date
Oct 13, 2006, 13:31 UTC
Message-ID
<452F9534.1030109@shadowen.org>
In-Reply-To
<d620685f0610130625o2d5f70c5p7cb41f567093df32@mail.gmail.com>
apodtele wrote:
Show 34 quoted lines
> Hi!
> 
> On 10/12/06, Nicolas Pitre <nico@cam.org> wrote:
>> On Thu, 12 Oct 2006, A Large Angry SCM wrote:
>> > Martin Waitz wrote:
>> > > On Thu, Oct 12, 2006 at 03:20:09PM -0700, A Large Angry SCM wrote:
>> > > > > +    if (it)
>> > > > > +        return it * width / (it + width) + 1;
>> > > > > +    else
>> > > > > +        return 0;
>> > > > No conditional needed:
>> > > >
>> > > >  return it * width / (it + width - 1)
>> > >
>> > > But then it would start scaling much earlier
>> > > (for width 10: at 2 instead of 4).
>> > > This is not bad per se, but different...
>> > >
>> >
>> > OK:
>> >       return (it * width + (it + width)/2)) / (it + width - 1)
>> >
>> > Now it's back at 4. ;-)
>>
>> Sure, but at this point the original conditional is probably more
>> efficient.
>>
> 
> Don't make me use
>            return it * width / (it + width) + !!it;
> -
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
return it * width / (it + width) + (it != 0)
Perhaps?
-apw
Previous: apodteleNext: Junio C Hamano
Message 11 of 16 in “diff --stat: use asymptotic scaling in graph”
  1. 1/2 diff --stat: use asymptotic scaling in graphapodtele, Oct 12, 2006
  2. Martin WaitzOct 12, 2006
  3. apodteleOct 12, 2006
  4. A Large Angry SCMOct 12, 2006
  5. Martin WaitzOct 12, 2006
  6. A Large Angry SCMOct 12, 2006
  7. Johannes SchindelinOct 12, 2006
  8. apodteleOct 12, 2006
  9. Nicolas PitreOct 13, 2006
  10. apodteleOct 13, 2006
  11. Andy WhitcroftOct 13, 2006
  12. Junio C HamanoOct 12, 2006
  13. A Large Angry SCMOct 12, 2006
  14. Junio C HamanoOct 12, 2006
  15. apodteleOct 13, 2006
  16. Junio C HamanoOct 14, 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.