Any C++ guru want to optimize TH1::Fill() to make it fast?

I looked at TH1::Fill() function and

It is just so much faster to fill arrays than histograms …

most of the time for me at least, only 3 operations needed:

(MAX - MIN) / binWidth

before incrementing content by one.

but it seems like a lot of stuff going on for every fill, which slows things down. Anyone interested in making it faster?

Perhaps updating auxiliary variables once in a while, or only when accessed ?

Or have TH1F_SimpleFixedBin wich does not have all bells and whistles
but is truely fast.

Similar to TGraph and TGraphErrors

P.S. FillBuffer is not an option since memory is not unlimited.

Just calculate bin values yourself and use SetBinContent :slight_smile:) I gues it’ll be faster :slight_smile:)

I already replied to you in a separate mail.
If you can improve the fill operations by more than 10 per cent without introducing side effects, let me know, I will introduce your code.

And please send a piece of ruuning code illustrating the Fill performance penalty.