Uploaded image for project: 'Daffodil'
  1. Daffodil
  2. DFDL-1411

PERFORMANCE: Create our own mutable Stack class - scala.collection.mutable.Stack is just a list

XMLWordPrintableJSON

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Normal Normal
    • 2.0.0
    • 1.1.0
    • Back End
    • None

      I recently discovered that scala.collection.mutable.Stack is implemented in terms of a scala.collection.immutable.List.

      So every push allocates, every pop discards a list cell.

      We push and pop a bunch of stacks for every move the parser and unparser make.

      In addition the length() method takes O time for n items on the stack, though I'm not sure we ever call this.

      We should build a mutable stack class that uses an ArrayBuffer for the implementation.

      This will likely be faster, and will not push hard on the garbage collector.

              jchab Jessie Chab
              mbeckerle.dfdl Mike Beckerle
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: