Forums Register Login

Image redraws faster inside Eclipse than standalone

+Pie Number of slices to send: Send
I don't know if this is appropriate to Swing/AWT, or even if this is a Java issue, but I had quite a shock recently. I have been working on a kind of drawing program in which the user can select tiny control rectangles and drag them around, causing the shape of a polygon to change. (They are not implemented as Java Polygons or Shapes because some are one-dimensional). I have gotten it into pretty good shape, so I exported it from Eclipse, my development platform, into a standalone Java application. In the standalone application, each time I drag the mouse, the redrawing shows nasty flickering, as if it's running too slowly. While I was developing the application inside Eclipse, it ran perfectly, with no flickering whatsoever.

What gives? I'd expect that the in-Eclipse runs would be slower, because they're burdened with extra debugging baggage, while the exported standalone version should run faster. But the reverse is the case.

Any ideas?
+Pie Number of slices to send: Send
It could possibly be garbage collection. If it is, try increasing your heap size, that should help. Try -Xmx1024m.
+Pie Number of slices to send: Send
Thanks for the suggestion. I expanded the space to a gigabyte but it had not effect. I think that I shall have to develop some clever optimization algorithms.
2
+Pie Number of slices to send: Send
Another possibility: Eclipse is loading a different graphics library than what you get running standalone. Add the -verbose:class option to your command line (both in Eclipse and standalone). This option prints the name of each class loaded and the full path of the jar it came from. Look for graphics classes. That might give you some clues (it solved a few for me when I noticed Eclipse behavior different from command line behavior).
+Pie Number of slices to send: Send
Wow, the subtleties of Java continue to amaze me. I'll get to work on that approach. Thanks much!
+Pie Number of slices to send: Send
Another possibility is that you're using (say) Java 7 in one place and Java 6 in the other.
+Pie Number of slices to send: Send
I'm guessing that part of my problem lies in various software incompatibilities. I'm still using an ancient Mac Pro from 2006 -- eight years old! It was always adequate for my needs, but just in the last months it has been showing its obsolescence. I'm stuck with OS 10.7.5. Safari is starting to screw up. My image editing program (Pixelmator) is malfunctioning. And now this problem with Java. So I broke down and ordered a new Mac and expect to get it later this week. Does anybody want to bet that this WON'T fix all my problems?

I think that I should adopt a new signature: Pennywise and Pound Foolish.
+Pie Number of slices to send: Send
 

Another possibility is that you're using (say) Java 7 in one place and Java 6 in the other.



I'm pretty sure that's the problem. I have installed Java 7 on my Mac but, just to make sure, I checked and, sure enough, Eclipse was default-setting the build to Java 6. I changed the build to Java 7 and now it refuses to compile. I'll do some research before asking for help; it's probably something just as dumb as this mistake.
+Pie Number of slices to send: Send
I got my new iMac with Mavericks yesterday, and I've been an installin' fool for the last 24 hours, but I think I've gotten it up to speed. I downloaded the latest Eclipse and tried out my project, and it worked perfectly both inside and outside Eclipse. So it appears that the suggestions made by Paul Clapham and Peter Johnson were correct. We thus have a general rule for dealing with some problems with Java: buy a new computer. ;-)

Thanks for the help, fellows.
+Pie Number of slices to send: Send
Maybe not a general rule, but in your case where you were having performance problems, it doesn't hurt to get much better hardware!
rubbery bacon. crispy tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 820 times.
Similar Threads
Java Application Run in Background
How to get URL information
Flickering
Performance Advice
Eclipse Plug-in and dependencies from other JARs
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 19, 2024 05:17:41.