Skip to content

Inconsistent behavior across using map, broadcast and for/loops and FixedSizeArrays #42

@el-oso

Description

@el-oso

While investigating a performance difference between Vector and FixedSizeVector, I discovered that there was also a performance difference between map, broadcast and for/loops.

I am not 100% sure that all implementations are equivalent, but I made my best effort.

From the table below you can see that for simple calls stock Vectors perform equally except if the is a do block, but are a mixed bag for FixedSizeVectors
For more complicated things it is a mixed bag and for the full case that I am interested clearly a for/loop behaves differently between Vector and FixedSizeVector. At least on my computer.

With Vector

ID time GC time memory allocations
["Full", "Generated", "Vector"] 971.000 ns (5%)
["Non-Simple", "Broadcast", "Vector"] 5.570 μs (5%)
["Non-Simple", "Loop", "Vector"] 991.000 ns (5%)
["Non-Simple", "Map", "Vector"] 5.621 μs (5%)
["Simple", "Broadcast", "Vector"] 641.000 ns (5%)
["Simple", "Loop", "Vector"] 641.000 ns (5%)
["Simple", "Map Do", "Vector"] 3.937 μs (5%)
["Simple", "Map", "Vector"] 641.000 ns (5%)

With FixedSizeVector

ID time GC time memory allocations
["Full", "Generated", "FixedSizeVector"] 5.370 μs (5%)
["Non-Simple", "Broadcast", "FixedSizeVector"] 6.051 μs (5%)
["Non-Simple", "Loop", "FixedSizeVector"] 5.019 μs (5%)
["Non-Simple", "Map", "FixedSizeVector"] 6.001 μs (5%)
["Simple", "Broadcast", "FixedSizeVector"] 641.000 ns (5%)
["Simple", "Loop", "FixedSizeVector"] 3.536 μs (5%)
["Simple", "Map Do", "FixedSizeVector"] 3.917 μs (5%)
["Simple", "Map", "FixedSizeVector"] 641.000 ns (5%)

I include an MWE to replicate these results.

MWESLEEFPiratesNFSA.tar.gz

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions