Skip to content
Snippets Groups Projects
  1. May 03, 2012
  2. Apr 30, 2012
  3. Apr 28, 2012
  4. Apr 27, 2012
    • milan's avatar
      Remove redundant parenthesis. · c82a6386
      milan authored
      c82a6386
    • milan's avatar
      Fix warnings, formatting. · cd5acad3
      milan authored
      cd5acad3
    • milan's avatar
      Improve {Map, Set}.union. · cd96a904
      milan authored
      Instead of having a special case set `union` set_of_size_1 in union,
      move it to hedgeUnion, so it can be used recursively. Benchmark shows up
      to 30% speedup.
      cd96a904
    • milan's avatar
      Improve {Map, Set}.intersection. · b19776e5
      milan authored
      Use the hedge-intersection algorithm, similar to hedge-union and
      hedge-difference.
      
      Depending on inputs, this causes up to 80% speedup.
      
      Also remove Set.splitLookup, which was used only to define intersection.
      b19776e5
    • milan's avatar
      Once again revert argument capturing by local 'go' function. · cf2cdd50
      milan authored
      At last I found an example, where capturing the argument in local 'go'
      function in 'member' causes increased heap-allocation. It is caused by
      'go' function floating out of 'member' and allocating a dictionary and
      the key argument.
      
      This happens only with Map and Set methods. Therefore in IntMap and IntSet,
      'go' function still captures the argument (and GHC shows no increased
      heap-allocation as a result of that).
      cf2cdd50
    • milan's avatar
      Improve heap-allocation in mergeWithKey'. · 6f8344ef
      milan authored
      Avoid allocating the closure for local function 'merge'.
      6f8344ef
  5. Apr 25, 2012
    • milan's avatar
      Add fromSet method. · 044579a4
      milan authored
      Following a proposal on libraries@..., we add fromSet method to Map and
      IntMap:
        Map.fromSet :: (k -> a) -> Set k -> Map k a
        IntMap.fromSet :: (Key -> a) -> IntSet -> IntMap a
      It is implemented using exported Set and IntSet constructors.
      
      Map.fromSet is trivial, as Map and Set have the same structure.
      
      The IntMap.fromSet implementation is more complicated, as IntSet uses
      dense representation of several last leves of the trie.
      044579a4
    • milan's avatar
      Fix warnings. · a9b07a6e
      milan authored
      a9b07a6e
  6. Apr 24, 2012
    • milan's avatar
      Improve manual makefile for tests. · cdc2c695
      milan authored
      Leave dependencies on GHC instead of make.
      cdc2c695
    • milan's avatar
      Improve {Map, IntMap}.keysSet. · ab8460f8
      milan authored
      The keysSet method is now implemented using the exported constructors of
      Data.{Set, IntSet}.Base.
      
      The implementation of Map.keysSet is trivial, as Set and Map use same
      tree structure.
      
      The implementation of IntMap.keysSet is slightly complicated, because of
      the dense representation of IntSet, where several last levels of the
      tree are flatten into a bitmap.
      ab8460f8
    • milan's avatar
      Factor Data.IntSet into Data.IntSet.Base and Data.IntSet. · 57042dc6
      milan authored
      Similarly to Map and IntMap, the whole functionality is in
      Data.IntSet.Base. The Data.IntSet module just reexports methods from
      Data.IntSet.
      
      The only difference between Data.IntSet.Base and Data.IntSet is that
      Data.IntSet.Base exports the constructors of IntSet data type. This will
      be used in IntMap to define efficient versions of keysSet and fromSet.
      57042dc6
    • milan's avatar
      Factor Data.Set into Data.Set.Base and Data.Set. · ea8688fb
      milan authored
      Similarly to Map and IntMap, the whole functionality is in
      Data.Set.Base. The Data.Set module just reexports methods from Data.Set.
      
      The only difference between Data.Set.Base and Data.Set is that
      Data.Set.Base exports the constructors of Set data type. This will be
      used in Map to define efficient versions of keysSet and fromSet.
      ea8688fb
    • milan's avatar
      Add lookupLT, lookupGT, lookupLE, lookupGE methods. · 083451fb
      milan authored
      Following the proposal on libraries@..., we add lookupLT, lookupGT,
      lookupLE, lookupGE methods to Set, Map, IntSet and IntMap.
      
      The implementations were chosen using the LookupLE benchmark.
      Current implementations do not heap-allocate apart from the result.
      
      Corresponding tests are added. The test suites for Set and IntSet
      now use HUnit too.
      083451fb
    • milan's avatar
      On 32-bit architectures, improve highestBitMask. · dbc5fb6b
      milan authored
      Even on 32-bit architectures, bit shift of size 32 was performed.
      dbc5fb6b
  7. Apr 23, 2012
  8. Apr 22, 2012
  9. Apr 21, 2012
    • milan's avatar
      Improve Map indexing functions. · 299ba905
      milan authored
      * Manually inline findIndex and deleteAt to avoid allocation.
      
      * Give type to local 'go' function of findIndex and lookupIndex
        to avoid heap allocation.
      299ba905
    • milan's avatar
      Improve query functions of Map and Set. · 78c1e523
      milan authored
      As documented in the Note: Local 'go' functions and capturing,
      it is safe to use captured key argument in query functions.
      
      Also, in order to decrease allocation, the query functions in Map
      are manually inlined, so 'member' does not have to call 'lookup'
      and heap-allocate 'Just a'.
      
      Tests of query functions are much improved too.
      78c1e523
    • milan's avatar
      Insert missing space in an error message. · 0928ff02
      milan authored
      0928ff02
    • milan's avatar
      Prevent multiple warnings. · 1ae51a29
      milan authored
      Prevent multiple warnings caused by unsuccessful SpecConstr pass.
      We do so by not inlining helper testing function.
      1ae51a29
  10. Apr 20, 2012
    • milan's avatar
      Add empty line between Notes. · 8142b030
      milan authored
      8142b030
    • milan's avatar
      Inline Int{Map,Set}.{null, empty, singleton}. · c712fe4d
      milan authored
      These are probably inlined anyway, but we explicitly INLINE
      them in Map and Set, so we do also in IntMap and IntSet for consistency.
      c712fe4d
    • milan's avatar
      Improve query functions of IntMap and IntSet. · 9be5ec29
      milan authored
      As documented in the Note: Local 'go' functions and capturing,
      it is safe to use captured key argument in query functions.
      
      Also, in order to decrease allocation, the query functions in IntMap
      are manually inlined, so 'member' does not have to call 'lookup'
      and heap-allocate 'Just a'.
      
      Tests of query functions are much improved too.
      9be5ec29
    • milan's avatar
      Reorder the data constructors of Map and Set. · 03a0620f
      milan authored
      The order of constructors has clearly no effect on corectness.
      
      Inspired by the change in order of constructors of IntMap and IntSet,
      the benchmark shows slight improvement when changing the data
      constructors from Tip | Bin to Bin | Tip.
      
      Also, we now consistently use the same order of constructors in all
      these structures: Map, Set, IntMap, IntSet.
      03a0620f
    • milan's avatar
      Improve programming documentation. · bdae0d4f
      milan authored
      Move important programming comments to the beginning of the source file,
      give them names and refer to the from the source code where necessarry.
      bdae0d4f
    • milan's avatar
      Add forgotten GHC >= 7.0 condition in (!). · 1a682593
      milan authored
      The INLINABLE pragma works only for GHC >= 7.0 and generates
      warning for older compilers.
      1a682593
Loading