Spotted · Checked · Timestamped

Spots by DeHub

GPLv2: Show HN: go-git2 – libgit2 as pure Go, 10-100x faster than go

In this story

Show HN: go-git2 – 10-100x faster than go-git, libgit2 -> WASM -> Go

go-git2 is a Go git library (read-only for now) using libgit2 transpiled to Go with wasm2go. As a result, it builds with CGO_ENABLED=0 and cross-compiles without a C toolchain. It supports 64-bit Linux, macOS, and Windows today.<p>While go-git has been great for my uses, its performance on larger repos and quirky differences from the git CLI output have been tricky to work with. I&#x27;m a huge fan of wasm2go and go-sqlite3 and wanted to apply the same approach and see what could be done. Incredibly happy with the results thus far, with 10-100x improvements on my real-world use cases. On the django repo, finding commits touching a file goes from 40s with go-git to 350ms, against 255ms for git itself. And the only unsafe is in wasm2go&#x27;s bounds-checked memory accesses!<p>The API follows go-git v5, so read-only code is mostly a drop-in (still a few constructs to port). Write support is down the road.<p>The main module is MIT and the libgit2 module keeps the upstream license (GPLv2 w&#x2F; linking exception).<p>Give it a go!

Hacker News (front page) · 2 days
Show HN: go-git2 – libgit2 as pure Go, 10-100x faster than go-git for reads

go-git2 is a Go git library (read-only for now) using libgit2 transpiled to Go with wasm2go. As a result, it builds with CGO_ENABLED=0 and cross-compiles without a C toolchain. It supports 64-bit Linux, macOS, and Windows today.<p>While go-git has been great for my uses, its performance on larger repos and quirky differences from the git CLI output have been tricky to work with. I&#x27;m a huge fan of wasm2go and go-sqlite3 and wanted to apply the same approach and see what could be done. Incredibly happy with the results thus far, with 10-100x improvements on my real-world use cases. On the django repo, finding commits touching a file goes from 40s with go-git to 350ms, against 255ms for git itself. And the only unsafe is in wasm2go&#x27;s bounds-checked memory accesses!<p>The API follows go-git v5, so read-only code is mostly a drop-in (still a few constructs to port). Write support is down the road.<p>The main module is MIT and the libgit2 module keeps the upstream license (GPLv2 w&#x2F; linking exception).<p>Give it a go!

Hacker News (Show HN) · 2 days

← Running stories