New patches in /srv/darcs/git-mirrors/containers commit 62c5cc0f2ebe95d8cada8cb4451941368d1d2941 Merge: a9b7224... 234c1fc... Author: Milan Straka Date: Fri May 11 11:52:14 2012 -0700 Merge pull request #11 from thomie/master Data.Graph: refer to a better version of the King and Launchbury article commit 234c1fc8ed1c859699fd8ec8084ed251cc134e55 Author: Thomas Miedema Date: Fri May 11 18:35:21 2012 +0300 Refer to article with less spelling errors (open access, same content) commit a9b7224068ae60f73baacd5f76d2c27624d90120 Merge: 207010c... fff28d7... Author: Johan Tibell Date: Thu May 3 08:29:06 2012 -0700 Merge changes release by GHC HQ as 0.7.4.1 Conflicts: containers.cabal commit 207010cabd5d697c9e6688460afe01241e3687e1 Author: Milan Straka Date: Mon Apr 30 14:29:46 2012 +0200 Add tests and benchmarks to sdist. commit cfde03ba1e69dea36fb85288681ee9e236966beb Author: Milan Straka Date: Mon Apr 30 14:28:30 2012 +0200 Add comment to tests/Makefile. Add comment to tests/Makefile that users should use cabal to build and run tests. commit 556b80c6f7b457393428f42700405d04071491de Author: Milan Straka Date: Sat Apr 28 16:51:13 2012 +0200 Remove type of local 'go' function in query methods of Set and Map. The resulting implementations are a bit faster, and there seems to be no increased heap-allocation. I will confirm this by examining GHC memory allocation. commit 5810f064f1270688ebdcc7055545f3140f3aa5b2 Author: Milan Straka Date: Sat Apr 28 16:36:31 2012 +0200 Define Map.{union,difference,intersection}WithKey using mergeWithKey. The resulting implementations are approximately 40-50% faster, although for some input data the performance is worse. This happens * in unionWithKey, if the data are disjunct: 15% slowdown * in differenceWithKey, as now we recurse over the first tree and not the second. The slowdown happens also only for disjunct data: 30%. See the SetOperations benchmark for yourself if you are interested. commit bb7213c7d2f53c60d79e6b6bf5cac3d35234dc61 Author: Milan Straka Date: Sat Apr 28 16:35:51 2012 +0200 Add Map.mergeWithKey. commit c82a6386772774fe55475d375ceea0345acbb109 Author: Milan Straka Date: Fri Apr 27 13:34:48 2012 +0200 Remove redundant parenthesis. commit cd5acad324e64436428fdf24a4a8e4a2291e4f11 Author: Milan Straka Date: Fri Apr 27 11:58:55 2012 +0200 Fix warnings, formatting. commit cd96a9045df8d2f8d98d9ec6e13c4a2492f0836b Author: Milan Straka Date: Fri Apr 27 11:51:48 2012 +0200 Improve {Map, Set}.union. 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. commit b19776e51d99f9264c9449952950f5f6071a0aa3 Author: Milan Straka Date: Fri Apr 27 11:30:13 2012 +0200 Improve {Map, Set}.intersection. 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. commit cf2cdd50743f540c0781a6f1455cebec9a6042d1 Author: Milan Straka Date: Fri Apr 27 11:12:07 2012 +0200 Once again revert argument capturing by local 'go' function. 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). commit 6f8344ef7e22ba7dee1e97a86f976bbec29dcc50 Author: Milan Straka Date: Fri Apr 27 10:36:28 2012 +0200 Improve heap-allocation in mergeWithKey'. Avoid allocating the closure for local function 'merge'. commit 044579a42383a1de214717e66823b1f5c7869c0b Author: Milan Straka Date: Wed Apr 25 18:54:04 2012 +0200 Add fromSet method. 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. commit a9b07a6e0eff8103564de45785cdc69e6fb0c8f5 Author: Milan Straka Date: Wed Apr 25 18:45:59 2012 +0200 Fix warnings. commit cdc2c695b879ff18c0c830ff8d79e689c9ed8f6c Author: Milan Straka Date: Tue Apr 24 18:05:40 2012 +0200 Improve manual makefile for tests. Leave dependencies on GHC instead of make. commit ab8460f8017c1defb649df8413407153d6750d1c Author: Milan Straka Date: Tue Apr 24 17:32:04 2012 +0200 Improve {Map, IntMap}.keysSet. 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. commit 57042dc65cdedfc64d5f63e144b87c98443438f9 Author: Milan Straka Date: Tue Apr 24 16:58:05 2012 +0200 Factor Data.IntSet into Data.IntSet.Base and Data.IntSet. 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. commit ea8688fb6065da1f967168eab46029ef7be84407 Author: Milan Straka Date: Tue Apr 24 16:45:45 2012 +0200 Factor Data.Set into Data.Set.Base and Data.Set. 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. commit 083451fb0bcd3edcdfa9cc43bf688af408986011 Author: Milan Straka Date: Tue Apr 24 16:23:13 2012 +0200 Add lookupLT, lookupGT, lookupLE, lookupGE methods. 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. commit dbc5fb6be82398e391f40f31bbea81b859ceda9a Author: Milan Straka Date: Tue Apr 24 16:20:29 2012 +0200 On 32-bit architectures, improve highestBitMask. Even on 32-bit architectures, bit shift of size 32 was performed. commit ef6112461bdbb5574d57da2bebcea75f3cfc5fe6 Author: Milan Straka Date: Mon Apr 23 18:29:50 2012 +0200 Improve one of the benchmarked methods: lookupGE4. commit 0e6152727e6ef60b7ac12951a4c88c27952f210e Author: Milan Straka Date: Mon Apr 23 16:44:01 2012 +0200 Change ASCII character for underline from ^ to ~. We use the following: -- [Note: Some superimportant message] -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Unfortunately, -- ^ is wrongly picked up by Haddock. Instead we now use -- [Note: Some superimportant message] -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ commit 857ae5b7da3b730f579c546939e3d3776c237bff Author: Milan Straka Date: Mon Apr 23 15:54:13 2012 +0200 Change INLINE to INLINABLE on methods using Ord. As mentioned previously, INLINE - INLINABLE method chain does not result in specialization, it has to be INLINABLE - INLINABLE. commit 586df039376b0d1884d3c130be1b65b8f8b622e3 Author: Milan Straka Date: Mon Apr 23 10:57:45 2012 +0200 Add benchmark of lookupGE to choose best implementation. Most of the code is by Twan van Laarhoven, thanks. commit 349e88e2219d3ec3cdf40dbe0b3cd8e4ee00f7c3 Author: Milan Straka Date: Mon Apr 23 10:53:49 2012 +0200 Fix warnings. commit b77a60ad0f95df9556f8304095f6c8ea70e67882 Author: Milan Straka Date: Mon Apr 23 10:02:12 2012 +0200 Move SetOperations benchmark to its own subdirectory. Also improve the infrastructure to handle benchmarks in different subdirectories. commit af732b9bc06273684d821e75f93f424ae2141d6e Author: Milan Straka Date: Sun Apr 22 18:06:21 2012 +0200 Manually inline {Map,IntMap}.map. commit 6c430a5d7cb0bba29857b193729193217bcf048c Author: Milan Straka Date: Sun Apr 22 18:00:43 2012 +0200 Inline {Map,Set}.fold* when 2 arguments are given. Inlining folds when 2 arguments are given is consistent with Prelude.foldr and {IntMap,IntSeT}.fold*. commit 4cdb33f48129a01bc1eec3f1cfd02c94181d01f7 Author: Milan Straka Date: Sun Apr 22 17:54:00 2012 +0200 Remove obsolete comment about deleteWith. DeleteWith is no longer method of any collection. commit 32d84ba5eb82f34dbb8a8fabf07077d848cdb408 Author: Milan Straka Date: Sun Apr 22 17:48:29 2012 +0200 Improve heap-allocation by adding explicit type signatures. When a local 'go' function is using methods from Ord dictionary, this dictionary is heap-allocated at the entry to the outer function. If it is given explicit type mentioning the Ord class, the dictionary is passed on the stack, decreasing heap allocation. commit 299ba9054c1f9ac97fe66e6c422b1b32730855ec Author: Milan Straka Date: Sat Apr 21 22:14:42 2012 +0200 Improve Map indexing functions. * Manually inline findIndex and deleteAt to avoid allocation. * Give type to local 'go' function of findIndex and lookupIndex to avoid heap allocation. commit 78c1e523a6dacb092da6fa2deef04d498fd588a3 Author: Milan Straka Date: Sat Apr 21 21:41:22 2012 +0200 Improve query functions of Map and Set. 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. commit 0928ff026a70b759be060f6ea46a48c58957049c Author: Milan Straka Date: Sat Apr 21 21:37:14 2012 +0200 Insert missing space in an error message. commit 1ae51a2993b5518b8f1e39963a509c42a98dbaec Author: Milan Straka Date: Sat Apr 21 20:25:00 2012 +0200 Prevent multiple warnings. Prevent multiple warnings caused by unsuccessful SpecConstr pass. We do so by not inlining helper testing function. commit 8142b0304511b7a687e508a6c8bf5e28680a3154 Author: Milan Straka Date: Fri Apr 20 20:26:47 2012 +0200 Add empty line between Notes. commit c712fe4d92c3bfae59323eb74ba2259cb3e45a77 Author: Milan Straka Date: Fri Apr 20 18:32:18 2012 +0200 Inline Int{Map,Set}.{null, empty, singleton}. These are probably inlined anyway, but we explicitly INLINE them in Map and Set, so we do also in IntMap and IntSet for consistency. commit 9be5ec295996794259189db969efa39bc7378b54 Author: Milan Straka Date: Fri Apr 20 18:18:55 2012 +0200 Improve query functions of IntMap and IntSet. 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. commit 03a0620f8eaf0ad5af4d1f314d5e34842c3b23c3 Author: Milan Straka Date: Fri Apr 20 18:04:54 2012 +0200 Reorder the data constructors of Map and Set. 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. commit bdae0d4fce159d3f4d43e7a67930627419fe52de Author: Milan Straka Date: Fri Apr 20 17:57:35 2012 +0200 Improve programming documentation. Move important programming comments to the beginning of the source file, give them names and refer to the from the source code where necessarry. commit 1a682593892f44d4727a53a51685d29d47042d33 Author: Milan Straka Date: Fri Apr 20 17:43:14 2012 +0200 Add forgotten GHC >= 7.0 condition in (!). The INLINABLE pragma works only for GHC >= 7.0 and generates warning for older compilers. commit 6ab2ba0aada982256cb204c6e28846d846e97a6b Merge: 7332813... 9d72ff1... Author: Milan Straka Date: Sat Apr 14 19:04:41 2012 +0200 Merge branch 'master' of github.com:haskell/containers commit 73328131d9573d0b1d2cd2d18abad7399368e816 Author: Milan Straka Date: Sat Apr 14 18:44:37 2012 +0200 Improve IntSet.{union, difference, intersection}. Incorporate improvements achieved in IntMap implementation by using mergeWithKey' -- i.e., reorder and modify pattern matches of combining functions, to play nicely with pattern match compiler. Also improve the ``Tip vs Bin'' case handling. commit 0b3612276f50afeb89dbdf76d27c3a7c48508e48 Author: Milan Straka Date: Sat Apr 14 18:44:02 2012 +0200 Benchmark of set operations -- union, difference, intersection. commit 12d03ebd2755f6acb78516d8f7ca5954b1e76cb0 Author: Milan Straka Date: Sat Apr 14 18:40:31 2012 +0200 Scripts for comparing csv results of benchmarks. commit 1e3c78cf788a5b09fd121546cb2e7cacadc19617 Author: Milan Straka Date: Sat Apr 14 16:55:46 2012 +0200 Add IntMap.mergeWithKey. The slightly more general internal function mergeWithKey' is used to define both mergeWithKey and other combining functions union*, difference*, intersection*. The resulting implementations of union*, difference* and intersection* are no slower than before, and up to 30% faster in case of two large interleaved maps. Measured by benchmarks/SetOperations-IntMap.hs. commit 9d72ff15f739e6ab2633e71fdb366e44c5af8e8a Merge: d95988c... 76a2b9d... Author: Milan Straka Date: Fri Mar 30 10:08:45 2012 -0700 Merge pull request #10 from batterseapower/master Add traverseWithKey to Map and IntMap API commit 76a2b9d97429497fe4f88cc47eb4945ba7eda163 Author: Max Bolingbroke Date: Fri Mar 30 14:20:15 2012 +0100 Add traverseWithKey to Map and IntMap API Proposal reviewed and approved by the libraries list. Particular thanks goes to Thomas Schilling for his suggestions regarding how the function should be documented. commit e0dfe5274aa4d70646e93b66234100c89d9d2b8a Author: Milan Straka Date: Mon Mar 26 16:37:48 2012 +0200 Add Makefile for manually building tests. commit cb1f087a0c37d586496689db9041182d81615234 Author: Milan Straka Date: Mon Mar 26 16:39:07 2012 +0200 Small benchmark changes. * Uncomment all working benchmarks. * Use whnf instead of nf, as all containers are spine and key strict. * Overhaul Makefile. commit d95988c2fc7f920b3d6ec2f28166f06ec56be255 Author: Milan Straka Date: Wed Mar 14 18:30:43 2012 +0100 Mark Data.Map.(!) as INLINABLE instead of INLINE. This should have been done in commit 3f798e33. As mentioned in the commit log, the chain m ! k = find k m {-# INLINE (!) #-} find k m = ... {-# INLINABLE find #-} results in find not being specialized at the call site of (!). commit fff28d7c1cd8e6e39aa5e099c6e5611ff1b95a19 Author: Ian Lynagh Date: Thu Dec 15 20:11:19 2011 +0000 Bump version and relax deepseq dependency