[ROOT] TGraph::SetPoint performance

From: Maxim Nikulin (nikulin@gorodok.net)
Date: Thu Sep 02 2004 - 09:31:35 MEST


I'm writing a kind of slow control system. I use several histograms, two 
dimensional plots and TGTextView widgets. They should be "ready to 
display". If program receives entries one by one it works fine, but 
reading a file recorded early takes significant time.

Using the callgrind program I found several poor places. The first one 
was TGTextView::AddLine() (Posted in 
and fixed). Than my manipulations with TAxis::SetTimeDisplay() became 
most important (old post, for curiosity only 
http://root.cern.ch/phpBB2/viewtopic.php?t=992 ) and I found more cheap 

For two dimensional plots I use the TGraph class. When the program 
receives an entry it calls TGraph::SetPoint(). This leads to allocation, 
copying and deallocation of x and y arrays. I don't use TGraph::Set() to 
allocate large buffer due to (0, 0) points appear on my plots.

I propose to introduce additional member and split point number and 
array size for the TGraph suite. Are there any arguments against the 
solution? I checked it with restricted descendant of TGraph, but in 
general case it is more complicated than the TGTextView::AddLine() 
issue, that's why I decide to discuss it firstly.


This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:09 MET