Uploaded image for project: 'bgpcep'
  1. bgpcep
  2. BGPCEP-976

Improve PCEP message parsing interface

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Medium Medium
    • 0.16.2
    • None
    • PCEP
    • None

      AbstractMessageParser.validate() is operating on a List<Object>, but each implementation essentially treats the list as a queue – inquiring the first object and then maybe removing it before moving on.

      This is problematic with ArrayList, as its remove() method shifts elements in the array, i.e. it has O(N) complexity and gets slower with increasing number of elements.

      An alternative would be to use a LinkedList, which has O(1) remove(), but that suffers from worse locality and memory overhead.

      Change the validate() method to take a Queue instead, which allows us to use an ArrayDeque – and that has O(1) operations for everything we need.

            rovarga Robert Varga
            rovarga Robert Varga
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: