tkoolen / TypeSortedCollections.jl

Type-stable operations on type-heterogeneous collections

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allocations in mapreduce on master

tkoolen opened this issue · comments

Bisected to

a1d0ba6a11d94437955adf74bc43fa2ca6d861d6 is the first bad commit
commit a1d0ba6a11d94437955adf74bc43fa2ca6d861d6
Author: Keno Fischer <keno@alumni.harvard.edu>
Date:   Fri Jul 6 23:41:05 2018 -0400

    Stop removing functions without proving them nothrow in inlining
    
    E.g., consider
    
    ```
    struct Foo{T}; x::T; end
    f(b) = fieldtype(b ? Int : Foo{Int}, 1)
    ```
    
    We can conclude that f always returns `Int`. However,
    we cannot remove the fieldtype call, because it throws
    for `b === true`. We are a bit lucky in that our tfuncs
    are currently fairly imprecise in the cases where this
    would cause problems, largely masking the bug.
    This is essentially a generalization of #27912. As our
    tfuncs get more precise, this will get more and more
    important for correctness.

Fixed by making type of op a type parameter in the signature to force specialization. There were also allocations in a broadcast! test that were fixed by a let block in the testset; there were no allocations in usages outside of the testset anyway.