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

Re: JGIT: discuss: diff/patch implementation

From
FGFrancis Galiegue <fg@one2team.net>
Date
Nov 10, 2008, 18:11 UTC
Message-ID
<200811101911.19603.fg@one2team.net>
In-Reply-To
<200811101759.03864.robin.rosenberg@dewire.com>

Le Monday 10 November 2008 17:59:03 Robin Rosenberg, vous avez écrit : [Sorry if this is offtopic for the git mailing list...]

Show 10 quoted lines
> >
> > Well, this API has a problem from the get go, since it does... Char by
> > char comparison. Ouch.
> >
> > I'll try and hack it so that it does line by line, but given my Java
> > skills, uh...
>
> We might want a byte-oriented version. Converting to char first is way
> too slow.
>

Well, AFAICT, here is how the current git code detects whether a file is binary or not:

----
#define FIRST_FEW_BYTES 8000
int buffer_is_binary(const char *ptr, unsigned long size)
{
	if (FIRST_FEW_BYTES < size)
		size = FIRST_FEW_BYTES;
	return !!memchr(ptr, 0, size);
}
----
Easy enough to be coded in Java, hey, even I could do it :p

So, provided binary files are dealt with already, what penalty is left for Java to deal with?

-- 
fge
Previous: Robin RosenbergNext: Johannes Schindelin
Message 5 of 16 in “JGIT: discuss: diff/patch implementation”
  1. Francis GaliegueNov 10, 2008
  2. Robin RosenbergNov 10, 2008
  3. Francis GaliegueNov 10, 2008
  4. Robin RosenbergNov 10, 2008
  5. Francis GaliegueNov 10, 2008
  6. Johannes SchindelinNov 10, 2008
  7. Francis GaliegueNov 10, 2008
  8. Junio C HamanoNov 10, 2008
  9. Shawn O. PearceNov 10, 2008
  10. Francis GaliegueNov 10, 2008
  11. Johannes SchindelinNov 10, 2008
  12. Raimund BauerNov 11, 2008
  13. Shawn O. PearceNov 11, 2008
  14. Sverre RabbelierNov 11, 2008
  15. Rogan DawesNov 11, 2008
  16. Shawn O. PearceNov 11, 2008

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.