Skip to content
  • The original Julia code

    function fcount(x::Vector{Bool})
        sumx = sum(x)
        Dict{Bool, Int}(true => sumx, false => length(x) - sumx)
    end
    
    srand(2)
    bool = rand(Bool, 1000000000)
    @time fcount(bool)
    # 0.612951 seconds (629 allocations: 36.195 KiB)
    # Dict{Bool,Int64} with 2 entries:
    #   false => 499978312
    #   true  => 500021688
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment