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

Define dataids for BlockArray #65

Merged
merged 1 commit into from
Dec 10, 2018
Merged

Conversation

tkf
Copy link
Member

@tkf tkf commented Dec 9, 2018

Previously, Base.dataids(::BlockArray) was calling objectid which was rather slow:

julia> x = BlockArray(randn(6), 1:3);

julia> @btime Base.objectid($x)  # equivalent to dataids($x) before this PR
  150.738 ns (0 allocations: 0 bytes)
0x34d4c35d64a7d6ef

julia> @btime Base.dataids($x)
  1.647 ns (0 allocations: 0 bytes)
(0x00007fc3cc79fc40, 0x00007fc3cc79fbd0)

This patch also makes alias detection slightly stronger for block arrays. But I then noticed that block arrays can't have proper dataids because the number of "data arrays" can't be determined by the type parameters (if we try to make it precise, dataids cannot be inferred and also it's not O(1) function anymore).

FYI we are trying to improve alias detection in Base. The discussion in Julia repo is not super relevant to this issue. But I wonder this should be taken into account if we were to redesign it in Base: JuliaLang/julia#29546

@codecov-io
Copy link

codecov-io commented Dec 9, 2018

Codecov Report

Merging #65 into master will decrease coverage by 0.31%.
The diff coverage is 25%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #65      +/-   ##
==========================================
- Coverage   63.69%   63.37%   -0.32%     
==========================================
  Files          11       11              
  Lines         482      486       +4     
==========================================
+ Hits          307      308       +1     
- Misses        175      178       +3
Impacted Files Coverage Δ
src/blocksizes.jl 63.88% <0%> (-2.78%) ⬇️
src/blockarray.jl 78.88% <100%> (+0.23%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4cfcc05...18c4f66. Read the comment docs.

@dlfivefifty dlfivefifty merged commit 3fccb53 into JuliaArrays:master Dec 10, 2018
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 this pull request may close these issues.

3 participants