Slow down in a for loop using CINT

I’m having trouble with a ROOT macro I’ve written. I don’t have the code on this machine but hopefully someones seen this problem before.

My macro runs with “root -l root_processor.c”, and uses CINT. I have two for loops, one nested in the other. The outer loop scans one tree (which has two branches) and assigns the value of the second branch (a timestamp in nanoseconds) to a local variable. The second loop then compares a second tree (identical to the first but a different dataset) to this locally stored variable. I then have various outputs depending on if the timestamps are within a set time of each other. This works fine for small files (<4 million records in each tree) but slows down dramatically (~a factor of 100) when the for loops run for more than 4766000 records. Nothing in the records change dramatically and there are no extra searchs being performed, so I really don’t know what could be causing it. The time stamp is about 10^12 at that point, and I have these defined as doubles, and the iterators are defined as long integers so it shouldn’t be a problem with these.

Any ideas would be appreciated, I’ve been banging my head against a wall for some time now. I’m using ROOT version 5-28-00.

Cheers

Rich

[quote]This works fine for small files (<4 million records in each tree) but slows down dramatically (~a factor of 100) when the for loops run for more than 4766000 records.[/quote]CINT has some inherent limitation in its optimizer. Given the number of iteration I strongly recommend that you explicitly compile the code using ACLiC (i.e. do .L myscript.C+) which would given you more stable performance and much higher optimization.

Cheers,
Philippe.