Created
April 23, 2019 13:26
-
-
Save dionisos2/536b40fbc8ef57ef20b6cce30eb95d1c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
julia> function dg()::Int | |
N = 200000 | |
nheads::Int = @distributed (+) for i = 1:N | |
Int(rand(Bool)) | |
end | |
return nheads | |
end | |
dg (generic function with 1 method) | |
julia> @code_warntype dg() | |
Body::Int64 | |
1 ─ %1 = %new(Main.:(##42#43))::Core.Compiler.Const(getfield(Main, Symbol("##42#43"))(), false) | |
│ %2 = invoke Distributed.preduce(Main.:+::Function, %1::Function, $(QuoteNode(1:200000))::UnitRange{Int64})::Any | |
│ %3 = (Base.convert)(Main.Int, %2)::Any | |
│ (Core.typeassert)(%3, Main.Int) | |
│ %5 = π (%3, Int64) | |
└── return %5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment