for (int i = SIZE; --i != 0;)
汗。。。应该是for (int i = SIZE; i-- != 0;)
我原来都是写
for(int i = SIZE; --i >= 0;)
----------------------------------------------------------------------------
int a = x*y;
int b = y*z;
return a*b - a*b*x;
can be rewritten to:
int a,b;
return (a=x*y)*(b=y*z) - b*a*x;
with this code some stack operations are saved. but it produces very unreadable code in as error prone.
----------------------------------------------------------------------------
To look at the bytecode is always a good idea. A Good plugin for eclipse is this one.
http://asm.objectweb.org/eclipse/index.html
本文探讨了如何优化循环结构,避免不必要的堆栈操作,并讨论了通过调整代码结构来提高效率的方法,但同时也指出了这种做法可能降低代码可读性的风险。
2892

被折叠的 条评论
为什么被折叠?



