Thread (9 messages) flat view 9 messages, 5 authors, 2016-06-15

Re: JGIT: discuss: diff/patch implementation

From: Francis Galiegue <hidden>
Date: 2016-06-15 22:45:37

Le Monday 10 November 2008 17:59:03 Robin Rosenberg, vous avez écrit :
[Sorry if this is offtopic for the git mailing list...]
quoted
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help