Closed colinxs closed 5 years ago
Darn, this is probably due to the trait refactoring I did in #163.
Does #170 fix this for your real use case?
It looks like #170 fixes the above. Thanks for the quick fix!
Unfortunately I'm still running into a few performance issues when slicing. I think these aren't new, however (tested with v0.3.0 as well as #170)
x=rand(3,3)
y=rand(3)
a=AxisArray(x, [:x,:y,:z], [:foo1, :foo2, :foo3])
au=AxisArray(uview(x), [:x,:y,:z], [:foo1, :foo2, :foo3])
# With AxisArrays
@btime $y .= view($a, :x, :)
# 500.005 ns (3 allocations: 96 bytes)
@btime $y .= view($au, :x, :)
# 357.435 ns (2 allocations: 96 bytes)
@btime $y .= view($au, 1, :)
# 358.857 ns (2 allocations: 96 bytes)
@btime $y .= $au[:, 1]
# 275.429 ns (3 allocations: 160 bytes)
# Without AxisArrays
@btime $y .= view($x, 1, :)
# 15.149 ns (1 allocation: 48 bytes)
@btime $y .= uview($x, 1, :)
# 14.594 ns (0 allocations: 0 bytes)
@btime $y .= $x[:, 1]
# 29.032 ns (1 allocation: 112 bytes)
So it appears that any kind of slicing, with or without view
and integer indexing, is quite a bit slower.
Symbol-based indexing will always have a performance hit of some kind.
I'm not so sure whether the integer slicing performance hit relative to normal arrays is expected — feel free to open a separate issue for that if you like.
What's uview
?
They are stack-allocated array views from UnsafeArrays.jl. They are quite useful for getting maximally performant code.
Colin X Summers University of Washington Personal Robotics Lab www.colinxsummers.com
On Sat., 31 Aug. 2019, 04:47 Tim Holy, notifications@github.com wrote:
What's uview?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JuliaArrays/AxisArrays.jl/issues/169?email_source=notifications&email_token=AELLS2EEWZNYHNPXANF265LQHJK6JA5CNFSM4IRZ64F2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5TLGAI#issuecomment-526824193, or mute the thread https://github.com/notifications/unsubscribe-auth/AELLS2CB6JPPP7UDEJX2M6DQHJK6JANCNFSM4IRZ64FQ .
I bumped the project version to 0.3.3 so we can have this bug fixed.
@JuliaRegistrator register
Registration pull request created: JuliaRegistries/General/3239
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if Julia TagBot is installed, or can be done manually through the github interface, or via:
git tag -a v0.3.3 -m "<description of version>" 316abc8c84591693ed427eef5f789884c0f468f9
git push origin v0.3.3
v0.3.0:
5.115 ns (0 allocations: 0 bytes)
v0.3.1 and v0.3.2294.645 ns (3 allocations: 80 bytes)
versioninfo: