3 ms·
Here's a counterargument for this, just to be a fuddy-duddy: One of the key activities in programming is reasoning about time and space cost, and this is a spa
by phunge 12y ago
Here's a counterargument for this, just to be a fuddy-duddy:
One of the key activities in programming is reasoning about time and space cost, and this is a space optimization that's nondeterministic. It kicks in sometimes, or sometimes not at all, and happens behind the scenes at garbage collection time when it's nearly invisible. If you're sloppy, your program may have a huge asymptotic space usage, and this may paper over it. But the impl has heuristics, it may not work all the time -- even their example program needed Thread.sleep() calls! Unpredictable semantics help nobody. So I always liked explicit string interning (whatup, Lisp!).
All the same, faster is better and I'm sure this makes things faster.
Oh and can we talk about how broken it was that Java 6 and under had a fixed size pool for .intern()'d strings?
- peterashford 12y agoIt's controlled with a switch. Don't turn it on.
- brandonbloom 12y agoYour applications already sit upon a mountain of non-determinism. A typical web app runs against a database with a genetic query optimizer, on top of a VM with a concurrent generational GC, sharing virtual memory with a dozen other processes, arranged in a massive pyramid of caches, which are competing for CPU time from a multi-core monstrosity of a data-flow engine. The sooner we as programmers embrace stochastic methods, the better.