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 foldl for cartesian style arrays #407

Merged
merged 3 commits into from Aug 9, 2020
Merged

Conversation

tkf
Copy link
Member

@tkf tkf commented Aug 9, 2020

Commit Message

Specialize foldl for cartesian style arrays (#407)

This patch implements a specialization of foldl on arrays with
IndexCartesian index style. This gives us more than 2x speedup (see
sum_transpose benchmark).

The implementation mostly just redirects the call to foldl of
CartesianIndices. Most of the code is for compatibility with Julia
< 1.5. This PR also fixes a bug in foldl for multi-dimensional
Broadcasted (probably introduced by #403).

@codecov
Copy link

codecov bot commented Aug 9, 2020

Codecov Report

Merging #407 into master will increase coverage by 0.06%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #407      +/-   ##
==========================================
+ Coverage   90.82%   90.89%   +0.06%     
==========================================
  Files          25       25              
  Lines        1581     1592      +11     
==========================================
+ Hits         1436     1447      +11     
  Misses        145      145              
Impacted Files Coverage Δ
src/basics.jl 92.10% <100.00%> (+1.48%) ⬆️
src/processes.jl 93.03% <100.00%> (+0.17%) ⬆️

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 b8efeed...202df0a. Read the comment docs.

@tkf
Copy link
Member Author

tkf commented Aug 9, 2020

https://github.com/JuliaFolds/Transducers-data/blob/benchmark-results/2020/08/09/100019/result.md

ID time ratio memory ratio
["sum_transpose", "30", "noinit", "xf"] 0.43 (5%) ✅ Inf (1%) ❌
["sum_transpose", "30", "withinit", "xf"] 0.41 (5%) ✅ Inf (1%) ❌

@mergify mergify bot merged commit 735aae6 into master Aug 9, 2020
@mergify mergify bot deleted the cartesian-arrays branch August 9, 2020 23:10
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.

None yet

1 participant