Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-7355

PseudoClockScheduler: Performance problem


    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • None
    • 8.33.0.Final
    • None
    • None
    • 2023 Week 09-11 (from Feb 27)
    • NEW
    • NEW
    • ---
    • ---

      When we advance the time extremely often with huge amount of facts, there is a performance penalty in "org.drools.core.time.impl.PseudoClockScheduler::runCallBacksAndIncreaseTimer:197 when we remove the head by item on line 197.

      Would not it be more performant if on line 197 we call "queue.take()" (or "queue.poll()"), which will remove straight the head item, instead of going through "remove(item)" and get performance penalty of underlying calls to "indexOf(item)"? The performance of "remove(item)" is O(log(N)) compared to O(1) of the others.

      It burns around 5%+ of overall time in that 197 line (depending on the scenario/use case) when you have huge amount of facts and we advance the time often after inserting the facts.

            mfusco@redhat.com Mario Fusco
            rady66@hotmail.com Radoslav Ivanov (Inactive)
            0 Vote for this issue
            2 Start watching this issue