title: JFreeChart Performance
body: <p>I'm trying to plot some graphs simultaneously:
  Each representing an attribute and displays the results for several objects each containing its own data items series.
  I encounter very bad performance using either add(...) or addOrUpdate(...) methods of the TimeSeries -  time for plotting ~16,000 items is about 60 seconds.
  I read about the performance issue - <a href="http://www.jfree.org/phpBB2/viewtopic.php?t=12130&amp;start=0" rel="nofollow">http://www.jfree.org/phpBB2/viewtopic.php?t=12130&amp;start=0</a> - but it seems to me like it is much worse in my case for some reason.</p>
  
  <ol>
  <li>I'd like to understand whether this is truly the performance that I may squeeze out of the module (2.5GHz machine running windows - I doubt that).</li>
  <li>How can I get my application accelerated with this respect?</li>
  </ol>
  
  <p>Here is a basic version of the code (note that it is all done in a dedicated thread):</p>
  
  <pre><code>/* attribute -&gt; (Object -&gt; graph values) */
  protected HashMap&lt;String,HashMap&lt;Object,Vector&lt;TimeSeriesDataItem&gt;&gt;&gt; m_data = 
    new HashMap&lt;String,HashMap&lt;Object,Vector&lt;TimeSeriesDataItem&gt;&gt;&gt;();
  
  public void loadGraph() {
      int items = 0;
      for (String attr : m_data.keySet()) 
          for (Object obj : m_data.get(attr).keySet())
              for (TimeSeriesDataItem dataItem : m_data.get(attr).get(obj))
                  items++;
      long before = System.currentTimeMillis();
  
      // plot each graph
      for (String attr : m_data.keySet()) {  
          GraphXYPlot plot = m_plots.get(attr);
          plot.addToObservation(m_data.get(attr));
      }
  
      System.err.printf("Time for plotting %d items is:  %d ms", items, System.currentTimeMillis()-before);
      // =&gt; Time for plotting 16540 items is:  59910 ms
  }
  </code></pre>
  
  <hr>
  
  <pre><code>public void addToObservation(HashMap&lt;Object, Vector&lt;TimeSeriesDataItem&gt;&gt; plotData) {
      for (Object obj : plotData.keySet()) {
          SeriesHandler handler = m_series.get(obj);
          if (handler != null) {
              TimeSeries fullSeries = handler.getFullSeries();
              TimeSeries periodSeries = handler.getPeriodseries();
              for (TimeSeriesDataItem dataItem : plotData.get(obj)) {
                  fullSeries.add(dataItem);
                  periodSeries.add(dataItem);
              }
          }
      }
  }
  </code></pre>
  
  <p>Thanks a lot !</p>
  
  <p>Guy</p>