Hacker News new | ask | show | jobs
by rlmw 3990 days ago
Because he takes a reference to a char[] in the constructor without copying it. char[]s are mutable so this means that the internal state of his String can be mutated by something else without any synchronisation guarantees.
1 comments

But that's nothing to do with thread saftey - even with a single thread if the char[] changes then stuff blows up right?
Correct, and Java's String(char[]) makes a copy of the array for that reason. This article's benchmark gets a boost by avoiding that.