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

PseudoClockScheduler: Performance problem

XMLWordPrintable

    • 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.

        1. image-2023-03-01-22-09-19-764.png
          22 kB
          Radoslav Ivanov
        2. image-2023-03-01-22-19-19-041.png
          17 kB
          Radoslav Ivanov
        3. image-2023-03-28-15-31-25-090.png
          40 kB
          Radoslav Ivanov

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

                Created:
                Updated:
                Resolved: