Lieven De Foor (b-inside) asked a question.

Performance comparison of OpenEdge.Core.Collections.* vs Progress.Collections.* generic collections

I remember a presentation showing the performance difference between using the OpenEdge.Core.Collections in OE 12.2 (backed with a temp-table I believe) vs 12.8 (backed with generic collections) vs direct use of the generic collections, but I can't seem to find the ppt/pdf of this anymore?

Is this still available somewhere?


Mike Fechner likes this.
  • Peter Judge (Consultingwerk)

    I think there was something like that done in a sprint review once upon a time. Certainly for lists and maybe for other collection types too.

     

    I also included some information on this in a talk at the Vienna PUG in 2022, but sadly those presentations are not available in the PUG Challenge archive.

     

    In my tests for that presentation, moving from a wrapped ("backed by") temp-table to a wrapped Progress.Collections.IList<T> resulted in an ~20x performance improvement. Using a 'naked' Progress.Collections.IList<T> was about 1.5 times faster than that.

  • Lieven De Foor (TVH Parts Holding)

    Following up on this thread with some benchmark results (64-bit Windows, prowin.exe -b).

     

    We compared three ways to populate and iterate a list of character values (computing a length() checksum on every item, after a short warmup):

    1. Static NO-UNDO temp-table (create / for each)

    2. Progress.Collections.List<OpenEdge.Core.String> (Add + IIterator)

    3. Progress.Collections.List<CharBox>, where CharBox is a minimal final class with a single public character variable and a 1-arg constructor

     

    Results:

     

    500 loops x 20 items (10,000 total):

    - Static TT: 265 ms

    - List<OpenEdge.Core.String>: 10,368 ms

    - List<CharBox>: 384 ms

     

    500 loops x 200 items (100,000 total):

    - Static TT: 1,346 ms

    - List<OpenEdge.Core.String>: 99,639 ms

    - List<CharBox>: 3,887 ms

     

    1 loop x 10,000 items (10,000 total):

    - Static TT: 140 ms

    - List<OpenEdge.Core.String>: 9,809 ms

    - List<CharBox>: 420 ms

     

    Takeaways:

    - Almost all of the ~60-70x slowdown came from OpenEdge.Core.String, not Progress.Collections.List<T> itself. Using a minimal wrapper (CharBox) was ~25x faster than OpenEdge.Core.String.

    - Even with a minimal wrapper, List<CharBox> was still ~2.5-3x slower than a NO-UNDO temp-table.

     

    Hopefully primitive support for generic collections (which I believe is planned for a future 13.x release) will bridge the remaining performance gap by avoiding wrapper object allocation altogether.

     

    Minimal CharBox class used in the test:

     

    class CharBox final:

     define public variable Val as character no-undo.

     constructor public CharBox(icVal as character):

      assign this-object:Val = icVal.

     end constructor.

    end class.

  • Lieven De Foor (TVH Parts Holding)

    One more data point: I also tested .NET System.Collections.Generic.List<character> (Add + indexed Item[i] loop, after CLR warmup) on the same scenarios:

     

    500 loops x 20 items (10,000 total):

    - Static TT: 234 ms

    - List<OpenEdge.Core.String>: 10,549 ms

    - List<CharBox>: 349 ms

    - .NET List<character>: 120 ms

     

    500 loops x 200 items (100,000 total):

    - Static TT: 1,286 ms

    - List<OpenEdge.Core.String>: 104,629 ms

    - List<CharBox>: 3,910 ms

    - .NET List<character>: 1,068 ms

     

    1 loop x 10,000 items (10,000 total):

    - Static TT: 136 ms

    - List<OpenEdge.Core.String>: 10,231 ms

    - List<CharBox>: 377 ms

    - .NET List<character>: 104 ms

     

    Even with ABL-.NET bridge marshaling on every call, System.Collections.Generic.List<character> beat a static NO-UNDO temp-table by ~17-24% and was ~3-3.7x faster than Progress.Collections.List<CharBox>. That strongly suggests the

    remaining gap in Progress.Collections.List<T> is the per-item wrapper object allocation, which makes native primitive support in ABL generic collections even more interesting.

     

    • Lieven De Foor (TVH Parts Holding)

      I also re-ran the same benchmark with -clrnetcore and .NET Core was faster still:

       

      500 loops x 20 items (10,000 total):

      - Static TT: 168 ms

      - List<CharBox>: 389 ms

      - .NET Framework List<character>: 120 ms

      - .NET Core List<character> (-clrnetcore): 113 ms

       

      500 loops x 200 items (100,000 total):

      - Static TT: 1,338 ms

      - List<CharBox>: 4,202 ms

      - .NET Framework List<character>: 1,068 ms

      - .NET Core List<character> (-clrnetcore): 871 ms

       

      1 loop x 10,000 items (10,000 total):

      - Static TT: 143 ms

      - List<CharBox>: 420 ms

      - .NET Framework List<character>: 104 ms

      - .NET Core List<character> (-clrnetcore): 86 ms

       

      With -clrnetcore, System.Collections.Generic.List<character> was ~17-18% faster than .NET Framework, ~35-40% faster than a static NO-UNDO temp-table, and nearly 5x faster than Progress.Collections.List<CharBox>.