facebook

How to build for Production vs. Debug

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #268449 Reply

    Can somebody tell me how to compile my projects with optimization turned on vs. debug info? I’m looking for some kind of easy switch that our QA department could use when they build a given workspace from source code.

    Thanks for any help you might have.

    #268464 Reply

    Riyad Kalla
    Member

    As a quick tip, there is next to no performance improvement for anything other than a game in disabling the debugging information. Just leave it turned on (Java VMs are so advanced now these types of issues don’t impact performance, especially for something as heavy weight as a web app or even a client RCP app).

    If you are absolutely convinced it’s important, you can strip the debugging information from your project either using settings under your project properties, or by writing a custom Ant file that for the javac task specific sets all debugging information to off (see Ant manual for reference).

    I don’t want to sound preachy, I just want to stop you from spending a lot of time and effort on something that makes no difference in Java (not like in C/C++ where you can use compiler switches and O levels to help out your runtime performance. All *that* stuff is done real time inside of the VM based on real-time code analysis… it’s crazy)

    #268499 Reply

    fwiw, it actually is important in my case because the .class files go into an applet jar. Building for production makes the applet substantially smaller, so it starts a lot faster with limited bandwidth.

    It would be nice to have this as a simple toggle of some kind.

    Thanks for the response – Walter

    #268500 Reply

    Riyad Kalla
    Member

    fwiw, it actually is important in my case because the .class files go into an applet jar. Building for production makes the applet substantially smaller, so it starts a lot faster with limited bandwidth.

    ahhh good point, I wasn’t thinking of that.

    The only two ways I can think of are the ones I mentioned, with the Ant script being the easiest, because you could just have 1 target, something like “compile-optimized” that compiles and creates the JAR all without any debug info. That way you don’t have to change the project settings at all.

    There *might* be an Eclipse plugin for this, I’m just not aware of one.

    #268503 Reply

    Thanks. When I study the project properties I’m can’t seem to find optimization-related settings. But the Ant approach sounds better because I really need a way to deliver the project to Q/A at repetitive points in our development cycle with manual steps in the build process kept to an absolute minimum. I’ve done a few Ant scripts for other things in this workspace (which includes five separate projects). I seem to recall some way of telling Eclipse to generate an Ant script that duplicates my whole workspace build. Did I dream that? This would be an ideal way to deliver the whole ball of wax to Q/A if I could just modify that script, maybe even automatically, to make the compile optimized.

    Any thoughts?

    Thanks

    #268507 Reply

    Riyad Kalla
    Member

    When I study the project properties I’m can’t seem to find optimization-related settings

    Project Properties > Java Compiler, if you check the box at the top to override the workspace defaults, look down at the bottom under the “Classfile Generation” section ,that’s all the debugging symbol stuff.

    I seem to recall some way of telling Eclipse to generate an Ant script that duplicates my whole workspace build. Did I dream that?

    No. It won’t honor a web/ejb/ear project, but for a normal Java project using File > Export > General > Ant Buildfiles will get you started.

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: How to build for Production vs. Debug

You must be logged in to post in the forum log in