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

PseudoClockScheduler: Performance problem

    XMLWordPrintable

Details

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

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: