Hi all,
I create a huge dataset with 1 million Points (a scatter plot, but this is not so important).
It used to take me 20 seconds on Mac Book Dual Core 2 - 3G ram.
I've noticed that trying to add all my points one by one to XYSeries was the bottleneck. I've switched off the notify, but still no huge difference.
my code:
for(...){
series.add( x, y, false)
}
series.fireSeriesChanged();
By examining the source code I found the solution:
Switch off the autosort, which calls a "binarySearch" everytime you add a point - no matter what is the notify listeners state, and tries to add the point after any duplicates.
My data is already sorted, so no problem at all.
So, I create the XYSeries like this:
XYSeries series = new XYSeries(seriesTitle, false);
The process takes now only half a second.
Hope it helps.
Andreas
Improving performance for huge datasets - (autosort)
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
If you have that many data values, XYSeries is not the most efficient dataset...you could save some memory by using DefaultXYDataset, unless you need some of the flexibility of XYSeries.
Later, of course, you'll run into some other inefficiencies in JFreeChart with plotting 1 million data points. Hopefully we can address a few of those during 2008.
Later, of course, you'll run into some other inefficiencies in JFreeChart with plotting 1 million data points. Hopefully we can address a few of those during 2008.
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


I plot around 50+ [can go to 100] graphs and for each graph i have new XYSeries("Label") and each series i add to XYSeriesCollection(). I later use this collection to draw timeseries graph and when i add the data into the series i would have already sorted it. So will using the same logic new XYSeries("label",false). help the performance in this case as well?
Thanks
Deepak
Thanks
Deepak
Zzzzz....