Closed GoogleCodeExporter closed 9 years ago
Why do you think you get a speedup?
Is there any paper you know from?
Did you profile it without using exceptions.
Original comment by axelclk@gmail.com
on 14 Nov 2010 at 6:08
I've read about it in Effective Java by Joshua Bloch,(item#57),
also, I did some timing. For example, I've changed the method
WikipediaScanner.indexOfUntilNoLetter() to the method below and got 25%
speedup(41.5 sec -> 32.5 sec) on linux/amd64/1.6.22 JVM. The number of thrown
exceptions downed to 300k+ on the same set of 1000 pages.
protected int indexOfUntilNoLetter(char testChar, int fromIndex) {
int index = fromIndex;
char ch;
while (index < fSource.length) {
ch = fSource[index++];
if (ch == testChar) {
return index - 1;
}
if (Character.isLetter(ch)) {
if (fSource.length <= index) {
return -1;
}
continue;
}
return -1;
}
return -1;
}
Original comment by kazenni...@gmail.com
on 14 Nov 2010 at 6:47
I can not see a great effect on my testset on a Winddows box.
But you're right the throwing of exceptions should be avoided.
I commited your change here:
http://code.google.com/p/gwtwiki/source/detail?r=2630
Original comment by axelclk@gmail.com
on 15 Nov 2010 at 12:38
Original comment by axelclk@gmail.com
on 27 Jan 2012 at 3:45
Original issue reported on code.google.com by
kazenni...@gmail.com
on 14 Nov 2010 at 3:37