0

When I run code inside NetBeans it is very slow. However, when I convert the code to a standalone application it runs 5 times faster. That is awkward because it won't let me test it as it will truly run on a mac. I'm using netbeans 8.

The application involves heavy memory usage. I think maybe, just maybe, netbeans is limiting the size of the heap. Anyway passed the -Xmx2048m flag to the program.

clue: when I build the software to an .app file, then go inside that app package and edit the .plist file, I manually add the line2:

<key>VMOptions</key>
<string>-Xmx1024m</string>

and that's the only way to make it run fast as I would like. And that is only as standalone, outside netbeans.

awksp
  • 11,764
  • 4
  • 37
  • 44
Sebastian
  • 1
  • 1
  • You're not saying how long it takes. If it's something like 1 ms vs 5 ms, then you're just wasting time by measuring the measurement error. *** Use `Runtime.getRuntime().freeMemory()` and friends to find out more about memory; consider also printing [GC stats](http://stackoverflow.com/q/1815390/581205), – maaartinus Jul 18 '14 at 00:48

3 Answers3

2

You can change those parameters in netbeans by changing the Run Configuration (Right click your project and select Properties -> Run). It could also just be a simple case of the debugging enviroment overhead causing the slowdown.

Austinh100
  • 598
  • 3
  • 13
0

You can also try to set the heap space used by the IDE itself.

http://wiki.netbeans.org/FaqSettingHeapSize

Ben
  • 2,235
  • 18
  • 17
0

If the application is SWING-related, there were a number of performance issues in the JDK that were affecting Retina Macs. You should also try upgrading to a JDK release >8u40, where these problems were fixed.

Milen
  • 1,510
  • 1
  • 10
  • 8