[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[jgit-dev] Comparing JGit and CGit
|
I discoverad some funny numbers.
me@mac ~/SW/egitcontrib/jgit (master) $ time bash
/Users/me/.m2/repository/org/eclipse/jgit/org.eclipse.jgit.pgm/0.11.0-SNAPSHOT/org.eclipse.jgit.pgm-0.11.0-SNAPSHOT.sh
log -M -p >jgit.txt
real 0m3.880s
user 0m7.137s
sys 0m0.807s
me@mac ~/SW/egitcontrib/jgit (master) $ time git log -M -p >cgit.txt
real 0m16.420s
user 0m14.936s
sys 0m0.899s
Seems JGit beats the pants off C Git. A quick scans implies both version
produce correct diffs, but don't post this to the Git ML list just yet :)
There are some important differences. C Git produces more readable
diffs, i.e. something that a human would produce. It also has the extra
information in the hunk header that explains
Whether 4 or 16 seconds is important or not is another issue for this
particular case. Som other systems would probably require hours of
processing for this.
Another suprise (to me) is that it seems JGit uses more than one core,
i.e. it used 7.1 seconds of CPU time in 3.8 seconds, while it seems C
Git only used one core since real time is larger than CPU time. Maybe it
is just GC; I haven't investigates that.
---JGit diff---
@@ -410,6 +427,21 @@
conn.setReadTimeout(getTimeout() * 1000);
authMethod.configureRequest(conn);
return conn;
+ }
+
+ private void disableSslVerify(URLConnection conn)
+ throws IOException {
+ final TrustManager[] trustAllCerts = new TrustManager[]
{ new DummyX509TrustManager() };
+ try {
+ SSLContext ctx = SSLContext.getInstance("SSL");
+ ctx.init(null, trustAllCerts, null);
+ final HttpsURLConnection sslConn =
(HttpsURLConnection) conn;
+ sslConn.setSSLSocketFactory(ctx.getSocketFactory());
+ } catch (KeyManagementException e) {
+ throw new IOException(e);
+ } catch (NoSuchAlgorithmException e) {
+ throw new IOException(e);
+ }
}
final InputStream openInputStream(HttpURLConnection conn)
-- END JGit --
-- Corresponding C Git diff --
@@ -412,6 +429,21 @@ final HttpURLConnection httpOpen(String method, URL
u) throws IOException {
return conn;
}
+ private void disableSslVerify(URLConnection conn)
+ throws IOException {
+ final TrustManager[] trustAllCerts = new TrustManager[]
{ new DummyX509TrustManager() };
+ try {
+ SSLContext ctx = SSLContext.getInstance("SSL");
+ ctx.init(null, trustAllCerts, null);
+ final HttpsURLConnection sslConn =
(HttpsURLConnection) conn;
+ sslConn.setSSLSocketFactory(ctx.getSocketFactory());
+ } catch (KeyManagementException e) {
+ throw new IOException(e);
+ } catch (NoSuchAlgorithmException e) {
+ throw new IOException(e);
+ }
+ }
+
final InputStream openInputStream(HttpURLConnection conn)
throws IOException {
InputStream input = conn.getInputStream();
-- END C Git
-- robin