[tcljava-dev] [PATCH] Performance improvement
Brought to you by:
mdejong
From: Shawn B. <sh...@qc...> - 2002-04-09 20:52:35
|
I ran the JavaWorld article's Tcl scripts and got similar (but slightly slower) results for the four tests (JDK 1.3.1, Jacl CVS 1.3). Using a Profiler, I found a hot spot in Expression.java. The code attempts to see if the parsed value is an integer (or double). Unfortunately, it is passing non-numbers into strtod which is throwing an expensive RuntimeException. The attached fix was straightforward and borrows from the Tcl C code. The performance improvement is significant: Test 1 - For loop counting from 1 to 1,000,000 Before: 180 seconds After: 50 seconds Test 2 - Compare 1,000,000 integers for equality Before: 368 seconds After: 94 seconds -- Shawn Boyce QCOM, Inc. Quality Software is Our Business http://www.qcominc.com |