
1 Apr
2010
1 Apr
'10
1:11 p.m.
I think the point that Chris brought up applies mostly in cases where there is a lot of contended access between threads. If that is the case then it won't matter much for us as reading the input files is currently single threaded.
It's true, the biggest gains by far in the approach I was pointing out are when you have heavy concurrent access. I just saw Scott mention his code wasn't threadsafe so figured a multithreaded solution was desirable. However String.intern() can still be expensive even in a single-threaded environment. Replacing String.intern() with something simple like if (!hashSet.contains()) hashSet.add(str) should be roughly 2x quicker. Probably negligible in the grand scheme of things :) Chris