RCP Obfuscation and File Sizes

In response to my last post on obfuscation, Jeff McAffer asked if I had seen any space savings in the obfuscated code. Well l thought it would be an interesting exercise to run the numbers, and the results were surprising.

What follows is the list of plug-ins being obfuscated in my Market Contours application. A total of 809 classes are obfuscated in one way or another (some have exclusions that protect class and method names). The obfuscation was done with Zelix KlassMaster and line numbers were not scambled (scrambling line numbers can increase file sizes). So here are the numbers:

Plug-in							Before	After	Diff	% Diff
com.marketcontours.cache_1.0.0.200707122146.jar		5,103	5,679	576	11.29%
com.marketcontours.client_1.0.0.200707122146.jar	98,565	98,751	186	0.19%
com.marketcontours.context_1.0.0.200707122146.jar	102,159	93,646	-8,513	-8.33%
com.marketcontours.core_1.0.0.200707122146.jar		22,559	23,949	1,390	6.16%
com.marketcontours.data.text_1.0.0.200707122146.jar	18,404	20,097	1,693	9.20%
com.marketcontours.data.web_1.0.0.200707122146.jar	13,323	14,401	1,078	8.09%
com.marketcontours.data_1.0.0.200707122146.jar		26,926	28,042	1,116	4.14%
com.marketcontours.evaluation_1.0.0.200707122146.jar	176,009	180,630	4,621	2.63%
com.marketcontours.future_1.0.0.200707122146.jar	18,391	17,849	-542	-2.95%
com.marketcontours.resource_1.0.0.200707122146.jar	132,675	138,066	5,391	4.06%
com.marketcontours.result_1.0.0.200707122146.jar	28,213	27,802	-411	-1.46%
com.marketcontours.runtime_1.0.0.200707122146.jar	56,840	52,486	-4,354	-7.66%
com.marketcontours.stock_1.0.0.200707122146.jar		12,468	12,069	-399	-3.20%
com.marketcontours.ui.builder_1.0.0.200707122146.jar	98,212	95,134	-3,078	-3.13%
com.marketcontours.ui.chart_1.0.0.200707122146.jar	12,835	14,392	1,557	12.13%
com.marketcontours.ui.data.text_1.0.0.200707122146.jar	8,594	8,526	-68	-0.79%
com.marketcontours.ui.data.web_1.0.0.200707122146.jar	2,375	2,399	24	1.01%
com.marketcontours.ui.data_1.0.0.200707122146.jar	33,472	31,890	-1,582	-4.73%
com.marketcontours.ui.result_1.0.0.200707122146.jar	63,844	64,452	608	0.95%
com.marketcontours.ui.runtime_1.0.0.200707122146.jar	7,537	8,285	748	9.92%
com.marketcontours.ui.series_1.0.0.200707122146.jar	67,262	62,512	-4,750	-7.06%
com.marketcontours.ui.tradeshape_1.0.0.200707122146.jar	20,757	19,691	-1,066	-5.14%
com.marketcontours.ui_1.0.0.200707122146.jar		196,728	200,764	4,036	2.05%

Total change: 	-1,739	-0.14%

The results show that this obfuscation resulted in little if any space savings, with some jars actually increasing in size. One reason for this is that there is a good deal of inter-plugin API which causes many package names to be excluded from obfuscation. This type of API is pretty typical of RCP applications, so it’s likely that they’re generally not going to shrink much during obfuscation. And then when you add the Eclipse plug-ins and a JRE to your distribution, the small size decrease will appear even smaller.

So in short, there are good reasons for obfuscating an RCP application, but decreasing the size of your distribution isn’t one of them.