Hacker News new | ask | show | jobs
by bugfix-66 1331 days ago
Correct, Go is fast, very close to C.

And just like in C, if you want to avoid memory management overhead you can use a slice of structs, integers instead of pointers, and a freelist (if needed). For example, here is a pointerless sparse bit vector:

https://bugfix-66.com/7256e0772dc3b02d72abf15b171731c933fd44...

The article is storing parses in a balanced binary tree, like a packrat memoizing parser.

Here is the fastest balanced search tree in Go. It allocates (and uses Go's garbage collector) but you can easily use a slice of structs with integer index pointers and a freelist instead:

https://bugfix-66.com/c93e950965804eba90a34e0055985b1c42d5a1...

The above code will perform very similarly to C.