Hacker News new | ask | show | jobs
by piinbinary 3581 days ago
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...

1 comments

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.