Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-ui-dev] Deleting code

The nice thing about John's plug-in is that it gives you a reasonably 
small working set to start from. This kind of thing is exactly what we 
want to be looking at if we actually believe in "built to last" 
engineering.

McQ.




Jeff McAffer/Ottawa/IBM@IBMCA 
Sent by: platform-ui-dev-admin@xxxxxxxxxxx
03/17/05 22:40
Please respond to
platform-ui-dev@xxxxxxxxxxx


To
platform-ui-dev@xxxxxxxxxxx
cc

Subject
Re: [platform-ui-dev] Deleting code







This makes a lot of sense, however, you have to be careful.  Eclipse uses 
alot of what amounts to Class.forName() lookups (in 
createExecutableExtension) as well as some no to subtle reflect calls. To 
correctly identify these you would have to analyze the plugin.xmls and 
find or otherwise identify all contributed classes as being entry points. 

Similarly, tools like this may incorrectly identify inter-plugin interface 
implementors as ignorable (phew, now that was hard).  For example, say you 
implement Runnable in some internal class and then pass it to someone to 
run.  Even with call flow analysis it can be hard to identify that 
implementor as an entry point. 

In any event, identifying and eliminating dead code is of course a good 
thing. 

In the future it would also be interesting to apply code reduction, 
inlining and obfuscation techniques to get even more.  We have done 
experiments with this on the runtime and reduced the jar size by about 
25%.  Real savings are to be had! 

Jeff 



John Arthorne/Ottawa/IBM@IBMCA 
Sent by: platform-ui-dev-admin@xxxxxxxxxxx 
03/17/2005 05:02 PM 

Please respond to
platform-ui-dev


To
platform-ui-dev@xxxxxxxxxxx 
cc

Subject
[platform-ui-dev] Deleting code









Every line of code that we add to Eclipse increases its disk and memory 
footprint.  With this in mind, I wrote a little plugin that searches a 
given project or package and finds all methods with no references.  I ran 
this on org.eclipse.ui.workbench and it turned up over a thousand methods 
with no senders in non-API packages.  Some of these are false positives, 
since methods that override superclass or interface methods may still be 
called even if they are not referenced directly.  However, there is likely 
quite a lot of dead code here.  Deleting this dead code will make Eclipse 
smaller, and hopefully easier to maintain.  The attached file lists the 
unreferenced methods for org.eclipse.ui.workbench. 



If anyone wants to run this tool directly or play with its source, it is 
part of the org.eclipse.core.tools plugin in dev.eclipse.org.[attachment 
"ui-workbench-unused.txt" deleted by Jeff McAffer/Ottawa/IBM] 



Back to the top