• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Image redraws faster inside Eclipse than standalone

 
Ranch Hand
Posts: 133
1
Mac OS X
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It could possibly be garbage collection. If it is, try increasing your heap size, that should help. Try -Xmx1024m.
 
Chris Crawford
Ranch Hand
Posts: 133
1
Mac OS X
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).
 
Chris Crawford
Ranch Hand
Posts: 133
1
Mac OS X
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Wow, the subtleties of Java continue to amaze me. I'll get to work on that approach. Thanks much!
 
Marshal
Posts: 28177
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Another possibility is that you're using (say) Java 7 in one place and Java 6 in the other.
 
Chris Crawford
Ranch Hand
Posts: 133
1
Mac OS X
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Chris Crawford
Ranch Hand
Posts: 133
1
Mac OS X
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Chris Crawford
Ranch Hand
Posts: 133
1
Mac OS X
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Paul Clapham
Marshal
Posts: 28177
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe not a general rule, but in your case where you were having performance problems, it doesn't hurt to get much better hardware!
 
If you send is by car it's a shipment, but if by ship it's cargo. This tiny ad told me:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic