[quote]zipped -g:none bytecode: 2.4kb
sourcecode: 1.4kb
that’s 1:2 :o
enough to consider dynamic compilation, if it was allowed.
[/quote]
Yes, but have you actually attempted the dynamic compilation class? If the class to compile and load the dynamic classes is larger than the savings from compressing source code, then your net gains are actually worse than if you’d just used bytecode!
@Blah^3:[quote] I can imagine that increasing bytecode size stupidly - inlining is usually used to INCREASE code size, sacrificiing it to gain performance…
[/quote]
This isn’t C/C++, Blah. Every reference to a method or class eats up significant constant pool space over simply inlining it. i.e. implementing a “min(int a, int b)” would be far more costly than implementing “(a < b) ? a : b” in ten different places! The reason is that you have maybe three bytes (in the form of bytecodes) for the “?:” statement. For the method you need:
“min” (3 bytes) + CONSTANT_UTF8_Info structure (3 bytes)
“(I)II” (5 bytes) + CONSTANT_UTF8_Info structure (3 bytes)
method_info structure (8 bytes)
attribute_info structure (6 bytes)
code data (3 bytes - guesstimation)
That’s 31 bytes for the method if no one uses it! Using the “?:” syntax is already smaller by one byte, and compresses better to boot! That’s not to mention the bytecode associated with each method call, plus various overhead with the stack that I’m not even counting.
Being small in Java very much about avoiding method calls and class fields as much as possible.