Recompiling code at runtime

Is there a performance increase if you recompile “away” unused code at runtime or do the jvm take care of that for you? Switch cases and such I mean or cant this be answered in the general case? Do shorter bytecode representing the same code yield better performance?

If the code is unused, meaning that it is never run, then how can it be a performance problem?

This is the most out-of-this-world optimization technique I’ve ever heard of. Just stick to writing efficient algorithms, and you’ll do 90% of the work needed to get good performance out of your applications.