[英]Java2D / Graphics2D performance
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.
我正在研究Java中的图形可视化库,我只做了一些性能测试。
When I'm adding about 2000 vertices connected by 1000 - 3000 edges, it gets really, really slow. 当我添加大约2000个由1000 - 3000个边连接的顶点时,它变得非常非常慢。 There are tools out there doing way better ( gephi for example).. How do they do it?
那里有工具做得更好(例如gephi )..他们是如何做到的? Isn't Java2D hardware accelerated by default?
Java2D硬件默认不加速吗? Do I have to use some OpenGL lib?
我是否必须使用一些OpenGL库?
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). 我在JComponent中绘制图形,每隔几毫秒由一个计时器重新绘制(这并不重要,如果我给它100 ms或1 ms,它会保持非常慢)。
Is my approach flawed or shouldn't I use Java2D for this? 我的方法有缺陷还是我不应该使用Java2D?
Thank you for any help! 感谢您的任何帮助!
As Torious suggested you probably want to use a VolatileImage if you are working in Java2D to get the benefits of hardware acceleration. 正如Torious建议你可能想要使用VolatileImage,如果你在Java2D中工作以获得硬件加速的好处。
However - If you want absolute best performance, you are probably better off going for an OpenGL - based solution. 但是 - 如果你想要绝对的最佳性能,你可能最好选择基于OpenGL的解决方案。
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. LWJGL( http://lwjgl.org/ )专为游戏而设计,但允许您使用几乎所有相关的OpenGL功能,因此对于可视化也非常有用。 Might be worth giving it a try!
可能值得尝试一下!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.