Live data from Hacker News

Why is C faster than Java: git vs JGit

marc.info

101–106 of 106 posts

Re: Why is C faster than Java: git vs JGit

#101
post #92

Earlier quoted context omitted.

See: http://www.sqlite.org/different.html Money quote about half-way down the page: "SQL statements compile into virtual machine code" Every SQL database engine compiles each SQL statement into some kind of internal data structure which is then used to carry out the work of the statement. But in most SQL engines that internal data structure is a complex web of interlinked structures and objects. In SQLite, the compil…

Off-topic but relevant: I've been looking for info on just how database software does what it does. Ie from parsing the SQL query to hitting the disk, and everything in between. Anyone got any links or books?

Gray and Reuter's Transaction Processing is absolutely superb, and it covers a good part of this stack, everything lower-level than query planning. However, it covers every approach to doing this. If you want to know how Postgres, say, does it, that's a lot less information, and may be more digestible.

Re: Why is C faster than Java: git vs JGit

#102

I almost skipped this link; I assumed it was typical borring blog noise. It's not. This is an insightful post from the git mailing list which shows some of the real limitations that a top tier developer hits when trying to write Java code as fast as neatly optimized C code. Definitely worth reading.

I wonder why none of these benchmarks measure the performance of _optimized_ Java? All of our builds use Proguard optimization and some of the resulting bytecode is noticeably faster.

Re: Why is C faster than Java: git vs JGit

#103
post #101
post #92

Earlier quoted context omitted.

Off-topic but relevant: I've been looking for info on just how database software does what it does. Ie from parsing the SQL query to hitting the disk, and everything in between. Anyone got any links or books?

Gray and Reuter's Transaction Processing is absolutely superb, and it covers a good part of this stack, everything lower-level than query planning. However, it covers every approach to doing this. If you want to know how Postgres, say, does it, that's a lot less information, and may be more digestible.

Thanks. I am interested in the general theory of how every database does it; it bothers me that this area of software engineering is terra incognita to me.

Re: Why is C faster than Java: git vs JGit

#104
post #93

Earlier quoted context omitted.

There are also details and examples at http://www.sqlite.org/vdbe.html Things have changed a bit since then, but not much. SQLite's API is very different than regular databases because it is a library operating in the same process. In particular it does not calculate all result rows for a query up front (that wouldn't be very 'Lite') but instead calculates the next matching row as you ask for it. Consequently the int…

In particular it does not calculate all result rows for a query up front (that wouldn't be very 'Lite') but instead calculates the next matching row as you ask for it. That sounds like SQL cursors?

If you squint really hard you could make that case, but in SQLite they are really not the same. You cannot use SQL syntax and you can't do other operations on cursors other than read the columns for the matching row.

Virtually all other database engines calculate the query results up front. It is more effective in their implementations to do it that way. For example they will also calls to ask how many rows remain in the results. SQLite has no such API and the only way to find out is to actually retrieve each result row.

Re: Why is C faster than Java: git vs JGit

#105

Earlier quoted context omitted.

Yep. The usual "Program X is faster in C than Java" gets a barrage of "That's because you know C better". Shawn is a performance-obsessed Java expert, Eclipse committer and longtime Google coder who works on JGit. If he says Java is slower than C at this, then Java is slower than C at this. EDIT: but as wcoenen points out, this was written in 2009 and Java 1.7 does a better job with some of this.

He's an expert you say? That was certainly not my expectation from the article. (1) Blind faith in Generics. This alone screams newb to me. He says that he got better performance with a custom data structure (no shit sherlock) but then seems deeply surprised by this. Duh. Okay, well, obviously he's relatively new to Java, but hey, he could still be a performance expert. (2) Never mentions the biggest weapon in the C…

I believe he is simply just counting his experience while porting GIT to Java. No where did I find that he claims he's an expert. What he did was providing his experience on the trenches.

In case if you are the expert, I would assume that he wouldn't mind if you have any insights to tune in the performance of JGit even further. You can start by joining in the mailing list.

He wasn't quantifying anything since he was not answering your question, he was sharing his experience.

Re: Why is C faster than Java: git vs JGit

#106
post #64
post #11

I wonder where do Shawn work at Google and in which product they use jgit.

You look at this presentation which talks about JGit at Google, if you skip the first few slides... https://docs.google.com/present/edit?id=0ATM14GNiXaXfZGZkeHp...

I don't have access to this doc somehow.
Post reply on HN