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

Specialize isassigned for AbstractFill #351

Merged
merged 3 commits into from
May 4, 2024
Merged

Specialize isassigned for AbstractFill #351

merged 3 commits into from
May 4, 2024

Conversation

jishnub
Copy link
Member

@jishnub jishnub commented Feb 9, 2024

Since an AbstractFill is by definition filled with values, we may short-circuit isassigned:

julia> F = Fill(3, 100, 100);

julia> @btime isassigned($(Ref(F))[], 1, 1)
  24.297 ns (0 allocations: 0 bytes) # master
  3.360 ns (0 allocations: 0 bytes) # PR

Copy link

codecov bot commented Feb 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.90%. Comparing base (99278fa) to head (e36922a).
Report is 16 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #351   +/-   ##
=======================================
  Coverage   99.90%   99.90%           
=======================================
  Files           8        8           
  Lines        1037     1061   +24     
=======================================
+ Hits         1036     1060   +24     
  Misses          1        1           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@longemen3000
Copy link

seems good to merge, at first i thought that this would affect OneElement, but that type subtypes AbstractArray instead

@jishnub
Copy link
Member Author

jishnub commented Apr 26, 2024

I've specialized isassigned for a OneElement as well, as the same logic would apply. Since the array is always initialized with a value, the elements should all be assigned as long as they are in range.

@jishnub jishnub merged commit dfe0e62 into master May 4, 2024
18 checks passed
@jishnub jishnub deleted the isassigned branch May 4, 2024 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants