的Proguard? http://proguard.sourceforge.net/
You are aware of Proguard? http://proguard.sourceforge.net/
这是一个伟大的字节码优化器,它实现了很多优化。有关列表,请参阅常见问题解答: http://proguard.sourceforge.net/FAQ.html
This is a great bytecode optimizer which implements a lot of optimizations. See the FAQ for a list: http://proguard.sourceforge.net/FAQ.html
- 评估常数表达式。
- 删除不必要的字段访问和方法
调用。 / li>
- 删除不必要的分支。
- 删除不必要的比较和
instanceof测试。
- 删除未使用的代码
。
- 合并相同的代码块。
- 减少变量分配。
- 删除
只写字段和未使用的方法
参数。
- 内联常数字段,
方法参数和返回值。
- 简短或仅
调用一次。
- 简化尾递归
调用。
- 合并类和接口。
- 尽可能使方法为private,static和
final。
- 在可能的情况下创建类
static和final。
- 替换具有单个
实现的接口。
- 执行超过200
个窥视孔优化,例如
替换... * 2由...<< 1。
- (可选)
删除日志记录代码。
- Evaluate constant expressions.
- Remove unnecessary field accesses and method
calls.
- Remove unnecessary branches.
- Remove unnecessary comparisons and
instanceof tests.
- Remove unused code
blocks.
- Merge identical code blocks.
- Reduce variable allocation.
- Remove
write-only fields and unused method
parameters.
- Inline constant fields,
method parameters, and return values.
- Inline methods that are short or only
called once.
- Simplify tail recursion
calls.
- Merge classes and interfaces.
- Make methods private, static, and
final when possible.
- Make classes
static and final when possible.
- Replace interfaces that have single
implementations.
- Perform over 200
peephole optimizations, like
replacing ...*2 by ...<<1.
- Optionally
remove logging code.
请查看源代码以了解如何实现它们。
I'm sure you can further look into the source code to understand how they are implemented.