4

Maybe there's someone out there who has spent time on this. I'm working on a graph visualization lib in Java and I just did some performance tests.

When I'm adding about 2000 vertices connected by 1000 - 3000 edges, it gets really, really slow. There are tools out there doing way better (gephi for example).. How do they do it? Isn't Java2D hardware accelerated by default? Do I have to use some OpenGL lib?

I'm drawing the graphs inside a JComponent which gets redrawn by a timer every few milliseconds (doesn't really matter, if I give it 100 ms or 1 ms, it stays really slow).

Is my approach flawed or shouldn't I use Java2D for this?

Thank you for any help!

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
Dänu
  • 5,791
  • 9
  • 43
  • 56

1 Answers1

0

As Torious suggested you probably want to use a VolatileImage if you are working in Java2D to get the benefits of hardware acceleration.

However - If you want absolute best performance, you are probably better off going for an OpenGL - based solution.

LWJGL ( http://lwjgl.org/ ) is designed for games but allows you to use pretty much all the relevant OpenGL functionality so is pretty good for visualisation as well. Might be worth giving it a try!

mikera
  • 105,238
  • 25
  • 256
  • 415