Implemented a few improvements
I've implemented a few improvements to gotext for my own use and thought I'd offer them back.
The first is a set of "Append" equivalents to the Get[NC] methods that append to a byte slice instead of allocating new strings. This improves performance substantially:
BenchmarkGoText/strings-16 748399 1627 ns/op 160 B/op 6 allocs/op
BenchmarkGoText/byte-slices-16 1044115 1094 ns/op 48 B/op 3 allocs/op
I also have a patch that replaces gotext's maps/mutexes with lock-free hashmaps. The performance improvement wasn't as dramatic as I had hoped, and it requires an additional dependency (hashmap) and bumping the required Go version to 1.18 for generics support, so I'm not sure it'll meet the bar for inclusion in gotext. Performance (vs the above):
BenchmarkGoTextHashmaps/strings-16 915142 1342 ns/op 160 B/op 6 allocs/op
BenchmarkGoTextHashmaps/byte-slices-16 1195036 893.6 ns/op 48 B/op 3 allocs/op
If there's any interest, I can rebase it on top of the current version and push it to my repo for review.