Skip to content
  • Andreas Klebinger's avatar
    Check for singletons when creating Bag/OrdList from a list. · 18cb4f5e
    Andreas Klebinger authored
    This gives us `One x` instead of `Many (x : [])` reducing overhead.
    For compiling spectral/simple with -O0 difference was ~ -0.05%
    allocations.
    
    The only drawback is that something like toOL (x:panic "") will now
    panic.  But that seems like a reasonable tradeoff.
    
    Test Plan: ci, looking at +RTS -s
    
    Reviewers: bgamari, jmct
    
    Reviewed By: bgamari
    
    Subscribers: jmct, rwbarton, thomie, carter
    
    Differential Revision: https://phabricator.haskell.org/D4770
    18cb4f5e