<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: J2ME Optimizations</title>
	<atom:link href="http://www.agilefusion.com/2006/09/29/j2me-optimizations/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.agilefusion.com/2006/09/29/j2me-optimizations/</link>
	<description>Integrating into the future</description>
	<pubDate>Tue, 06 Jan 2009 21:07:31 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
		<item>
		<title>By: Gal</title>
		<link>http://www.agilefusion.com/2006/09/29/j2me-optimizations/#comment-247</link>
		<dc:creator>Gal</dc:creator>
		<pubDate>Thu, 28 Dec 2006 08:14:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.agilefusion.com/2006/09/29/j2me-optimizations/#comment-247</guid>
		<description>Hi Alexey,

Would like to connect with you. Have an initiative in the mobile space and looking for a technologists.

Can you send me your email/ phone?

Thanks

Gal</description>
		<content:encoded><![CDATA[<p>Hi Alexey,</p>
<p>Would like to connect with you. Have an initiative in the mobile space and looking for a technologists.</p>
<p>Can you send me your email/ phone?</p>
<p>Thanks</p>
<p>Gal</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Landwehr</title>
		<link>http://www.agilefusion.com/2006/09/29/j2me-optimizations/#comment-71</link>
		<dc:creator>David Landwehr</dc:creator>
		<pubDate>Mon, 09 Oct 2006 07:13:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.agilefusion.com/2006/09/29/j2me-optimizations/#comment-71</guid>
		<description>The problem was not to do with initialization of the CSSHelper as initializing a couple of 100 constants does not take 50 seconds not even on a mobile phone. However this issue did reveal an interesting problem when a class uses final static arrays which are supposed to be removed in the shrinking/obfuscating phase (this is only verified with proguard). E.g. if you have:
private static final VALUES = {"Value1", "Value2", "Value3"};

and you remove all reverences to VALUES then the proguard obfuscater will remove VALUES in the class, however if you decompile the class you will find the following code:
static {
  String[] a = new String[3];
  a[0] = "Value1";
  a[1] = "Value2";
  a[2] = "Value3";
}

Which means that the class constant pool will have constants which is never used. This will impact the application in two ways:1)  the jar size will be larger size the constants is included. 2) the constants will increase the VM's heap size since they are interned and the loading time of the class will increase because of this (e.g. it will take time to intern the strings and initializing the array which will later be garbage collected which also takes time).

The solution is to either use a flag in the definition of the static array, like:
private static final VALUES = FLAGS.INCLUDE ? {"Value1", "Value2", "Value3"} : null;
or to make use the entire class is removed in the obfuscation step.</description>
		<content:encoded><![CDATA[<p>The problem was not to do with initialization of the CSSHelper as initializing a couple of 100 constants does not take 50 seconds not even on a mobile phone. However this issue did reveal an interesting problem when a class uses final static arrays which are supposed to be removed in the shrinking/obfuscating phase (this is only verified with proguard). E.g. if you have:<br />
private static final VALUES = {&#8221;Value1&#8243;, &#8220;Value2&#8243;, &#8220;Value3&#8243;};</p>
<p>and you remove all reverences to VALUES then the proguard obfuscater will remove VALUES in the class, however if you decompile the class you will find the following code:<br />
static {<br />
  String[] a = new String[3];<br />
  a[0] = &#8220;Value1&#8243;;<br />
  a[1] = &#8220;Value2&#8243;;<br />
  a[2] = &#8220;Value3&#8243;;<br />
}</p>
<p>Which means that the class constant pool will have constants which is never used. This will impact the application in two ways:1)  the jar size will be larger size the constants is included. 2) the constants will increase the VM&#8217;s heap size since they are interned and the loading time of the class will increase because of this (e.g. it will take time to intern the strings and initializing the array which will later be garbage collected which also takes time).</p>
<p>The solution is to either use a flag in the definition of the static array, like:<br />
private static final VALUES = FLAGS.INCLUDE ? {&#8221;Value1&#8243;, &#8220;Value2&#8243;, &#8220;Value3&#8243;} : null;<br />
or to make use the entire class is removed in the obfuscation step.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
