JFreeChart Performance?

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
kenzo
Posts: 4
Joined: Thu Feb 07, 2008 11:44 am
Location: Toulouse

JFreeChart Performance?

Post by kenzo » Thu Feb 07, 2008 12:31 pm

Hello,
I created a benchmark for assessing animations using JfreeChart, and i get this results:
- In the animation A1,I use JFreeChart in a Swing window and the animation uses between 47% and 52% of the cpu time.
- In the animation A2, I place charts in a swt window in an attempt to obtain performances (cpu time) close to swt thanks to the method

Code: Select all

SWT_AWT.new_Frame(Composite parent)
.
Unfortunately, I obtain the same performances (cpu time) that the animation A1 (JFreeChart in a Swing window : 52%).
- For the animation A3, I developped a chart in SWT that represents a gauge.
I use it in the animation A3 and only 25% of the cpu time is used.

So I would like to know if it's normal to obtain similar performances between JfreeChart into a Swing window and JfreeChart
into Swt window.

Thanks You.
Last edited by kenzo on Mon Feb 11, 2008 10:24 am, edited 1 time in total.

heprom
Posts: 91
Joined: Sat May 27, 2006 4:25 am
Location: Paris

Post by heprom » Sun Feb 10, 2008 9:41 am

I don't think Cpu usage is a good indicator of performance. You'd better measure system time in ms before and after drawing processes. And you should measure it not only for one draw but for hundreds or perhaps a thousand draw operations to avoid scattering.

HTH,
Henry

Taqua
JFreeReport Project Leader
Posts: 698
Joined: Fri Mar 14, 2003 3:34 pm
Contact:

Post by Taqua » Sun Feb 10, 2008 3:52 pm

A1 and A2 cannot yield different results.

A2 actually creates a buffered image, then calls Swing to fill the image and then displays that using SWT methods. In anyway, neither SWT nor Swing should yield big differences in performance.

Swing on Windows uses DirectDraw for rendering, so it uses all the acceleration your Graphics card can possibly provide. In case SWT also maps all the Graphics2D calls into DirectDraw calls, then it will equally fast. If SWT would use some creepy old school drawing (which is very very unlikely), then SWT would be slower. By no means you can expect SWT to be noticeable faster than Swing.

Usually the bottle neck with JFreeChart is not the graphics system but how the chart engine is used. Badly implemented large datasets cause troubles, as well as various abuses of the chart-api itself. And sometimes JFreeChart's rendering is suboptimal too.

Locked