Skip to content

Collect callable: just forward to copy when possible #136

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

Merged
merged 2 commits into from
Jun 4, 2025

Conversation

nsajko
Copy link
Collaborator

@nsajko nsajko commented Jun 3, 2025

Helps effect inference infer nothrow.

Fixes #43

Helps effect inference infer `nothrow`.

Fixes JuliaArrays#43
@nsajko
Copy link
Collaborator Author

nsajko commented Jun 3, 2025

Before:

julia> v(x) = collect_as(FixedSizeVector, x)
v (generic function with 1 method)

julia> m(x) = collect_as(FixedSizeMatrix, x)
m (generic function with 1 method)

julia> Base.infer_effects(v, Tuple{FixedSizeVectorDefault{Float32}})
(!c,!e,!n,+t,+s,!m,!u,+o,!r)

julia> Base.infer_effects(m, Tuple{FixedSizeMatrixDefault{Float32}})
(!c,!e,!n,+t,+s,!m,!u,+o,!r)

After:

julia> v(x) = collect_as(FixedSizeVector, x)
v (generic function with 1 method)

julia> m(x) = collect_as(FixedSizeMatrix, x)
m (generic function with 1 method)

julia> Base.infer_effects(v, Tuple{FixedSizeVectorDefault{Float32}})
(!c,!e,+n,+t,+s,!m,!u,+o,!r)

julia> Base.infer_effects(m, Tuple{FixedSizeMatrixDefault{Float32}})
(!c,!e,+n,+t,+s,!m,!u,+o,!r)

julia> VERSION
v"1.13.0-DEV.682"

Copy link

codecov bot commented Jun 3, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.32%. Comparing base (1be0830) to head (71a323f).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #136      +/-   ##
==========================================
+ Coverage   94.27%   94.32%   +0.05%     
==========================================
  Files           5        5              
  Lines         227      229       +2     
==========================================
+ Hits          214      216       +2     
  Misses         13       13              

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@nsajko nsajko merged commit 9f3017c into JuliaArrays:main Jun 4, 2025
12 checks passed
@nsajko nsajko deleted the copy_optimization branch June 4, 2025 08:59
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.

potential performance improvement: specialize copying constructor
2 participants