• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Java programming in OS X

Pandamonium

Golden Member
I'm writing a program in Java. My home machines run XP Pro, while my lab runs OS X. (It's a C2D iMac). There is no reason why my 700MHz P3 should outperform the iMac when running my program. Does anyone know how to force OS X or the JVM to actually use the full CPU?

FWIW, the program analyzes images. Right now, I can almost read my debug code (System.out.println(...)) as the iMac processes it. In Windows, the debug code scrolls waay too fast for me to focus on anything.
 
On a related note, does anyone have any idea how to do a circular regression? So far, I've managed to detect edge points along a circle (it's taking 4 seconds to go through a ~1500x1000 px area and detecting about 20 edge points). Now that I have a bunch of edge coordinates in XY-space, I'm wondering how I can efficiently determine my circle's center and radius. Google is turning up all sorts of nonlinear math hits for me.
 
This is probably unlikely, but it's not the System.out.println's that are causing the slow downs is it? If you comment out the println's and time the task by System.currentTimeMillis, is it still slower?
 
Does the P3 have more RAM? 1GB vs. 512 MB could make a huge difference in performance if the code is using too much RAM.

Also check flashbacck's suggestion about the debug print statements.
 
why don't you just run it in a profiler? you'll get a call tree with billed times, which in turn will show you if it's your code or JVM that's running into a wall.
 
Myself and 3 other people I work with all use OS X and we are heavy java developers. Best platform for java development in my opinion. But I assume it also depends on what environment you are using. We all use eclipse.
 
Commenting out the system.out.println code makes it run about 10% faster. I might try a java profiler, but I've never used one so I don't know where to begin. I'm using Eclipse in OS X and GILD/Eclipse in XP.

The strange thing is that the same set of code now runs slower on my workstation than on the OS X machine. I'm taking a 2000x1312px jpg and putting pixel data into R[2000][1312] G[2000][1312] B[2000][1312] arrays. The code in this section hasn't been changed, but it's taking 100+ sec in XP and 4sec in OS X all of a sudden. I'm using bufferedimage's getRGB method- is there faster alternative? (From what I gather, getRGB is far faster then PixelGrabber).
 
Originally posted by: Codewiz
Myself and 3 other people I work with all use OS X and we are heavy java developers. Best platform for java development in my opinion. But I assume it also depends on what environment you are using. We all use eclipse.
On Intel or ppc? Eclipse is a nightmare on my 1.5ghz g4.

I second the suggestion of experimenting console output. It can be much slower than you'd think and is probably highly os-dependant. Even piping the output to a file instead of displaying it onscreen can make a noticeable difference. But yeah, a profiler'd shed some light on that or whatever else the problem is.
 
Back
Top