Hacker News new | ask | show | jobs
by tmaly 3581 days ago
I wrote my own in Go that is blazing fast using bytes. I know the data is ascii so I was able to use that to my advantage.
1 comments

I did the same [0]. It runs almost as fast as the Java implementation.

I'd be interested to see how yours works if you are willing to share it.

Edit: Plus one that is ~2x faster than Java by avoiding allocations [1].

[0] https://gist.github.com/jmikkola/6ac96ad6d6f66e772c33ec41ed2...

[1] https://gist.github.com/jmikkola/7ded8392226b7659c881f5540be...

Note that internally Java represents strings as utf-16
Depends. The API for strings in java is mostly UTF16 but the latest JVM will magically use UTF8 as its internal representation.
Only the Oracle one, it doesn't apply to other vendors.