JuliaArrays / ArraysOfArrays.jl

Efficient storage and handling of nested arrays in Julia
Other
43 stars 9 forks source link

Performance assessment #36

Closed shayandavoodii closed 12 months ago

shayandavoodii commented 12 months ago

As stated in the doc and the header of the readme.md, you claimed that this is a package " for efficient storage and handling of nested arrays.". However, you have not provided any performance evaluations! Can you please think about it and provide proof for what you've stated? How much is this efficient? Compared to what is this package efficient?

oschulz commented 12 months ago

@shayandavoodii , whether the ArraysOfArrays types are more efficient than standard nested arrays depends very much on the use case. In scenarios where the there are (very) many small to medium-sized inner arrays, a memory layout backed by a single block of memory (as provided by ArraysOfArrays) saves a lot of memory allocations and is more cache-friendly than standard nested arrays. But if there are only a few inner arrays, resp. if the size of the inner arrays is large compared to the size of the outer array, there may not be a noticeable performance gain.

It's not easy to come up with truly representative benchmarks given the many different ways nested arrays can be used. The package is, however, in active use in several projects and has proven itself in practice. That said, you are of course welcome to contribute a set of benchmark, ideally in the form of a pull request.

shayandavoodii commented 12 months ago

In scenarios where the there are (very) many small to medium-sized inner arrays, a memory layout backed by a single block of memory (as provided by ArraysOfArrays) saves a lot of memory allocations and is more cache-friendly than standard nested arrays.

It is essential to define "many" and "small" here since the definitions of these can be subjective. For example, for me, "many" is 1000, and "small" is "100" which may differ from your definition! So this is still ambiguous.

you are of course welcome to contribute a set of benchmark, ideally in the form of a pull request.

Sure! However, I do not know what operation should I perform.

oschulz commented 12 months ago

It is essential to define "many" and "small" here since the definitions of these can be subjective. For example, for me, "many" is 1000, and "small" is "100" which may

Indeed - but that's not so easy, because it'll depend on the platform, whether it's CPU or GPU arrays and so on. I would recommend that you test whether standard nested arrays or ArraysOfArrays arrays are more suitable for your specific use case.

shayandavoodii commented 12 months ago

I would recommend that you test whether standard nested arrays or ArraysOfArrays arrays are more suitable for your specific use case.

Sure, I'll report the results and the setups.