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

map/map! with >2 input arrays is slow #9900

Closed
simonster opened this issue Jan 23, 2015 · 1 comment
Closed

map/map! with >2 input arrays is slow #9900

simonster opened this issue Jan 23, 2015 · 1 comment
Labels
performance Must go faster

Comments

@simonster
Copy link
Member

A = randn(100, 100)
B = randn(100, 100)
C = randn(100, 100)
D = randn(100, 100)

type TestFun; end
call(::TestFun, x, y) = x+y
call(::TestFun, x, y, z) = x+y+z

julia> @time map!(TestFun(), A, B, C);
elapsed time: 2.4984e-5 seconds (80 bytes allocated)

julia> @time map!(TestFun(), A, B, C, D);
elapsed time: 0.004941339 seconds (1432016 bytes allocated)

julia> @time map(TestFun(), B, C);
elapsed time: 0.000102774 seconds (80160 bytes allocated)

julia> @time map(TestFun(), B, C, D);
elapsed time: 0.004965889 seconds (1512384 bytes allocated)

This is because map/map! with >2 arguments uses an inefficient strategy to extract the values from the input arrays. Maybe these should be staged functions?

@simonster simonster added the performance Must go faster label Jan 23, 2015
@simonster
Copy link
Member Author

Same issue as #17321

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Must go faster
Projects
None yet
Development

No branches or pull requests

1 participant