# Hadd performance question

**URL:** <https://root-forum.cern.ch/t/hadd-performance-question/33263>\
**Category:** ROOT\
**Created:** [March 21, 2019, 2:29pm UTC](https://root-forum.cern.ch/t/hadd-performance-question/33263 "2019-03-21T14:29:59Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![rustem](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/r/c0e974/32.png) [@rustem](https://root-forum.cern.ch/u/rustem)\
**Post date:** [March 21, 2019, 2:29pm UTC](https://root-forum.cern.ch/t/hadd-performance-question/33263/1 "2019-03-21T14:29:59Z")

</div>

Hello,

I am trying to merge 500 files with ~3 MB size per file and each containing a few thousand histograms and one TTree. I have noticed following:

– hadd completes file directory scan within ~15 minutes;

– hadd writes target file with ~150 MB size;

– Then there is nothing visible happening for more than a half an hour after that: output file is not modified and there are no messages. It seems that the target file is complete when I try to browse its content.

– For the past 30 minutes, hadd memory footprint stays constant at 3.7 GB while it is consuming 100 % CPU without any messages or updates to the target file.

I am wondering if this last step of hadd is necessary since it takes so much time? Is hadd just trying to clean up objects in memory?

I am running 6.14/06 version compiled with gcc 7.3.0 on Ubuntu 18.04. I can post the input files for tests if this helps (but it seems that this is a general hadd question).

Thank you,  
Rustem

* * *

_ROOT Version:_ Not Provide  
_Platform:_ Not Provided  
_Compiler:_ Not Provided

* * *

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [March 21, 2019, 2:47pm UTC](https://root-forum.cern.ch/t/hadd-performance-question/33263/2 "2019-03-21T14:47:46Z")

</div>

As it looks like an I/O question I guess @pcanal can help you.

---

<div class="post-metadata">

**Author:** ![pcanal](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pcanal/32/12439_2.png) [@pcanal](https://root-forum.cern.ch/u/pcanal)\
**Post date:** [March 29, 2019, 8:21pm UTC](https://root-forum.cern.ch/t/hadd-performance-question/33263/3 "2019-03-29T20:21:08Z")

</div>

> [@rustem](#):
>
> I am wondering if this last step of hadd is necessary since it takes so much time? Is hadd just trying to clean up objects in memory?

Yes, it is cleanup memory (and that clean-up does not scale well with the number of histogram). We are planning to add an option to hadd to skip that work,

Cheers,  
Philippe.

---

<div class="post-metadata">

**Author:** ![rustem](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/r/c0e974/32.png) [@rustem](https://root-forum.cern.ch/u/rustem)\
**Post date:** [April 2, 2019, 2:24pm UTC](https://root-forum.cern.ch/t/hadd-performance-question/33263/4 "2019-04-02T14:24:46Z")

</div>

Hi Philippe,

Thank you for your reply.

I would vote in favour of adding the option to skip this step! I think that in a typical use case this step is not needed as OS should clean up the memory anyway when hadd exits.

Cheers,  
Rustem

---

<div class="post-metadata">

**Author:** ![Axel](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/axel/32/11084_2.png) [@Axel](https://root-forum.cern.ch/u/Axel)\
**Post date:** [April 3, 2019, 9:28am UTC](https://root-forum.cern.ch/t/hadd-performance-question/33263/5 "2019-04-03T09:28:52Z")

</div>

IIRC we were discussing an option to _not_ skip this step - but skip it by default because it’s such a common case 🙂

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [April 17, 2019, 9:30am UTC](https://root-forum.cern.ch/t/hadd-performance-question/33263/6 "2019-04-17T09:30:20Z")

</div>

Closed on April 17, 2019, 9:30am UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.

---

<div class="post-metadata">

**Author:** ![pcanal](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pcanal/32/12439_2.png) [@pcanal](https://root-forum.cern.ch/u/pcanal)\
**Post date:** [October 24, 2019, 2:09pm UTC](https://root-forum.cern.ch/t/hadd-performance-question/33263/7 "2019-10-24T14:09:43Z")

</div>

Hi,

I finally managed to go through hadd is to consistently delete the objects and directories ‘right’ after use (rather than accumulating them in memory) and reduce the amount of cleanups needed. This should resolved all (known) performance issues with hadd. The fix is (will be) available in v6.20/00 and 6.18/06.

Cheers,  
Philippe.
