4 ms·
I would have used libgit2 myself in any languages. If bindings do not exist, I would have made the bindings first. There is no way I would have called out to an
by johnisgood 1y ago
I would have used libgit2 myself in any languages. If bindings do not exist, I would have made the bindings first. There is no way I would have called out to an external program.
Someone mentioned https://github.com/go-git/go-git https://github.com/go-git/go-git. I would have definitely used it unless there are better alternatives. If - as someone who claimed - it turns out it is slow, I would have created my own bindings to libgit2 still, most likely.
- throwaway894345 1y agoBinding to C in Go is a bad idea typically. There’s performance overhead, but more importantly your library (and everything downstream) also loses the ability to do nice things like fast compile times or easy cross compilation. You also likely introduce a runtime dependency on libc if not libgit2, so you have some DLL hell to deal with.
- johnisgood 1y agoIs the performance overhead significant? Is it worse than calling out to an external program? Are there any benchmarks on this?
- 9rx 1y ago> Is the performance overhead significant? How do you define significant? It is noticeable as compared to C. It is nothing compared to Python. > Are there any benchmarks on this? You will see an additional ~20ns per call (assuming the gc compiler; tinygo, for example, can call C functions as fast as C can). In other words, you're not ever going to notice unless you're making millions of calls in a hot loop. The bigger problem in a highly concurrent environment is that blocking C functions can start to mess with the scheduler if they are slow to return. You, again, would never notice in a program of this nature, though. The feature is there to be use. It being a "bad idea" is nonsense. Some added pain in compilation is, fairly, a tradeoff to consider. But that's just because C compilers, for the most part, aren't very good. It is not like those problems go away if you use C instead.
- johnisgood 1y agoYeah, but for this project, why would you choose (as others stated they would or prefer) to call out to an external program instead of using https://github.com/libgit2/git2go https://github.com/libgit2/git2go (libgit2, FFI) for example? For what it is worth, there is also a pure Go implementation: https://github.com/go-git/go-git https://github.com/go-git/go-git (pure Go). Keep in mind the initial comment, which is "I would have used libgit2 myself in any languages.", and they claimed it is a bad idea due to performance, as opposed to calling out to an external program.
- 9rx 1y ago> and they claimed it is a bad idea due to performance Which, as before, is nonsense.
- johnisgood 1y agoThank you, thought as much. I hope I will get a response from the person / people claiming this.
- 9rx 1y ago> I hope I will get a response from the person / people claiming this. You want more nonsense...?
- johnisgood 1y agoNo, I want people to be informed well, and that requires me to hear their side so I can dispute them. Many people has said they are thankful it calls out to "git" instead of using FFI, which I think is weird, but then there are others who go ahead and say that it is a worse thing to do, and I want people to know that no, it is not.
- bmf-san 1y agoYep, ggc is a wrapper around the git CLI — intentionally so. I chose to shell out to git because it's fast, stable, and has great cross-platform support. Tools like go-git and libgit2 are interesting (and I’ve looked into them), but they come with their own tradeoffs like performance, features, and build complexity. That said, I totally get the curiosity — thanks for the discussion!