Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

significant performance regression versus 0.3.0 #169

Closed
colinxs opened this issue Aug 29, 2019 · 8 comments · Fixed by #170
Closed

significant performance regression versus 0.3.0 #169

colinxs opened this issue Aug 29, 2019 · 8 comments · Fixed by #170

Comments

@colinxs
Copy link

colinxs commented Aug 29, 2019

x=rand(3,3)
a=AxisArray(x, [:x,:y,:z], [:foo1, :foo2, :foo3])
@btime $a[:x, :foo1]

v0.3.0:
5.115 ns (0 allocations: 0 bytes)
v0.3.1 and v0.3.2
294.645 ns (3 allocations: 80 bytes)

versioninfo:

Julia Version 1.1.1
Commit 55e36cc308 (2019-05-16 04:10 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, skylake)
@c42f
Copy link
Member

c42f commented Aug 30, 2019

Darn, this is probably due to the trait refactoring I did in #163.

@c42f
Copy link
Member

c42f commented Aug 30, 2019

Does #170 fix this for your real use case?

@colinxs
Copy link
Author

colinxs commented Aug 30, 2019

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.

@c42f c42f closed this as completed in #170 Aug 30, 2019
@c42f
Copy link
Member

c42f commented Aug 30, 2019

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.

@timholy
Copy link
Member

timholy commented Aug 31, 2019

What's uview?

@colinxs
Copy link
Author

colinxs commented Aug 31, 2019 via email

@c42f
Copy link
Member

c42f commented Sep 4, 2019

I bumped the project version to 0.3.3 so we can have this bug fixed.

@JuliaRegistrator register

@JuliaRegistrator
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants