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

implement iterate for a >2x speedup #91

Merged
merged 1 commit into from
Jan 19, 2025
Merged

Conversation

nsajko
Copy link
Collaborator

@nsajko nsajko commented Jan 19, 2025

No description provided.

@nsajko
Copy link
Collaborator Author

nsajko commented Jan 19, 2025

using FixedSizeArrays

function f(v)
    z = eltype(v)(false)
    for x  v
        z += x
    end
    z
end

using BenchmarkTools
using Random: rand!

const vec = FixedSizeVector(rand(Int8, 4096))

@btime f(vec) setup=(rand!(vec);)
  • on main: 72.995 ns (0 allocations: 0 bytes)
  • on PR branch: 30.924 ns (0 allocations: 0 bytes)

Copy link

codecov bot commented Jan 19, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.84%. Comparing base (2f729fe) to head (4021b2c).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #91      +/-   ##
==========================================
+ Coverage   98.82%   98.84%   +0.01%     
==========================================
  Files           3        3              
  Lines         255      259       +4     
==========================================
+ Hits          252      256       +4     
  Misses          3        3              

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

@oscardssmith oscardssmith merged commit 429ebe4 into JuliaArrays:main Jan 19, 2025
11 checks passed
@oscardssmith
Copy link
Collaborator

it's kind of dumb that this is necessary. What is the fallback, and can it be improved?

@nsajko nsajko deleted the iterate branch January 19, 2025 23:27
@nsajko
Copy link
Collaborator Author

nsajko commented Jan 21, 2025

can it be improved?

Yes, just adding an @inbounds gives the same speedup as here: JuliaLang/julia#57112

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.

2 participants