-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
Labels
performanceMust go fasterMust go faster
Description
I created this issue to move the discussion in #3224 over here.
I wrote a benchmark script on Gist to compare the performances of different approaches:
Here is what I get:
Benchmark with long columns
with_ref!: slow-down = 11.1970x # use a[:,i]
with_sub!: slow-down = 114.4806x # use sub(a, 1:m, i)
with_sub1!: slow-down = 1.1974x # use pointer_to_array
with_sub2!: slow-down = 2.5286x # use immutable sub-vector
Benchmark with short columns
with_ref!: slow-down = 261.4301x
with_sub!: slow-down = 1256.6697x
with_sub1!: slow-down = 38.8170x
with_sub2!: slow-down = 19.0293xWe can observe:
- The current version of
sub, which createsSubArrayis way too slow -- the overhead and indexing cost just dominate. - Using
a[:, i]which makes copies also kills performance - Both immutable sub-vector and using
pointer_to_arrayto create a shared-memory view work much better. That said, both lead to significant overhead when the columns are short. - Overall, the performance of creating a shared-memory array using pointer is better -- after all, you simply get the performance of builtin array. The limitation is that this applies only to contiguous blocks.
I may work on this as the first step towards better performance of Julia. But we need some discussion to settle on a approach first.
A problem with immutable is that methods defined on them do not get properly inlined, resulting in performance hit.
Metadata
Metadata
Assignees
Labels
performanceMust go fasterMust go faster