[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Soot Questions
Hi,
I have a few Soot questions:
1. Does Soot rearrange local variables so that the most commonly used
four variables are declared first (so as to have the JVM access it via a
shorter bytecode)? (First three variables for static methods.) I've
seen a number of situations where simple rearrangement can produce
smaller and faster bytecode.
2. Does Soot declare classes without subclasses as final?
3. Is there a strength reduction facility?
a. >> & << for * & /
b. m & n - 1 for m % n, where n is a power of 2
Without JIT enabled (as it fails miserably under HP-UX), or with it but
with an older CPU (non-HP-UX), these transformations can offer a
significant improvement in speed. Instead of hypothesizing about how
much of a performance gain you can get, even under optimal conditions,
do some tests and compare real numbers. Compare suboptimal conditions.
4. Replace String + with StringBuffer.append()? (Requires the addition
of a new StringBuffer, which may cause an unexpected OutOfMemoryError.)
5. Move class-declared constants into an interface. (This could break
reflection, but for those who know they aren't using it ...) This saves
space because constants defined using "static final" are included in the
class file, and inlined when used. From an OO point of view, an
interface should define a type (thus not be a collection of constants),
but from a Java point of view, there's room for some optimization.
Some of these questions are from:
http://www-2.cs.cmu.edu/~jch/java/size.html
http://www-2.cs.cmu.edu/~jch/java/speed.html
Sincerely,
Dave Jarvis
--
Invoq Systems Inc.
t. 250.380.0304
e. djarvis@invoqsystems.com
w. http://www.invoqsystems.com