Skip to content

Conversation

@jishnub
Copy link
Member

@jishnub jishnub commented Mar 23, 2024

Using broadcast inside a broadcast operation leads to recursion, which impedes type inference. This PR changes the inner operation to a map, which makes the broadcast fully type inferred.
On master

julia> B = BlockArray([1:3;], [2,1]);

julia> A = zeros(3);

julia> @btime $A .= $B;
  1.075 μs (14 allocations: 816 bytes)

This PR

julia> @btime $A .= $B;
  454.323 ns (9 allocations: 624 bytes)

@codecov
Copy link

codecov bot commented Mar 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.58%. Comparing base (ea33af1) to head (4148544).
Report is 6 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #351      +/-   ##
==========================================
+ Coverage   92.66%   93.58%   +0.92%     
==========================================
  Files          16       16              
  Lines        1499     1497       -2     
==========================================
+ Hits         1389     1401      +12     
+ Misses        110       96      -14     

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

@jishnub jishnub marked this pull request as draft March 23, 2024 14:32
@jishnub jishnub force-pushed the jishnub/broadcasttypeinfer branch from 8b9e9c2 to 2b4115e Compare March 25, 2024 08:40
@jishnub jishnub marked this pull request as ready for review March 25, 2024 09:29
@jishnub jishnub merged commit 772c307 into master Mar 25, 2024
@jishnub jishnub deleted the jishnub/broadcasttypeinfer branch March 25, 2024 10:36
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