on main help sign in
[#27] Add table with benchmark results to README (#35)
d91f137Dmitrii Kovanikov
README.md+17−2
@@ -2,12 +2,12 @@
2
2
3[![Hackage](https://img.shields.io/hackage/v/typerep-map.svg)](https://hackage.haskell.org/package/typerep-map)
3[![Hackage](https://img.shields.io/hackage/v/typerep-map.svg)](https://hackage.haskell.org/package/typerep-map)
4[![Build status](https://secure.travis-ci.org/kowainik/typerep-map.svg)](https://travis-ci.org/kowainik/typerep-map)
4[![Build status](https://secure.travis-ci.org/kowainik/typerep-map.svg)](https://travis-ci.org/kowainik/typerep-map)
5−[![Stackage LTS](http://stackage.org/package/typerep-map/badge/lts)](http://stackage.org/lts/package/typerep-map)
6−[![Stackage Nightly](http://stackage.org/package/typerep-map/badge/nightly)](http://stackage.org/nightly/package/typerep-map)
7[![MIT license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/vrom911/typerep-map/blob/master/LICENSE)
5[![MIT license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/vrom911/typerep-map/blob/master/LICENSE)
8
6
9`typerep-map` introduces `TypeRepMap` — data structure like [`Map`](http://hackage.haskell.org/package/containers-0.6.0.1/docs/Data-Map-Lazy.html#t:Map), but where types serve as keys, and values have the types specified in the corresponding key spots.
7`typerep-map` introduces `TypeRepMap` — data structure like [`Map`](http://hackage.haskell.org/package/containers-0.6.0.1/docs/Data-Map-Lazy.html#t:Map), but where types serve as keys, and values have the types specified in the corresponding key spots.
10
8
9+## Usage example
10+
11```haskell
11```haskell
12ghci> let typeRepMap = insert (Identity True) $ one (Identity (42 :: Int))
12ghci> let typeRepMap = insert (Identity True) $ one (Identity (42 :: Int))
13
13
@@ -36,3 +36,18 @@ ghci> let trMap = delete @Int typeRepMap
36ghci> member @Int trMap
36ghci> member @Int trMap
37False
37False
38```
38```
39+
40+## Benchmarks
41+
42+Tables below contain comparision with `DMap TypeRep` of ten `lookup` operations
43+on structure with size `10^4`:
44+
45+| | ghc-8.2.2 | ghc-8.4.3 |
46+|----------------|-----------|-----------|
47+| `DMap TypeRep` | 517.5 ns | 779.9 ns |
48+| `typerep-map` | 205.3 ns | 187.2 ns |
49+
50+ ghc-8.2.2 | ghc-8.4.3
51+:---------:|:-----------:
52+![DMap 8.2.2](https://user-images.githubusercontent.com/4276606/42495129-c700f21e-8454-11e8-98b4-ba080259c712.png) | ![DMap 8.4.3](https://user-images.githubusercontent.com/4276606/42495168-ebb1d13c-8454-11e8-9d17-f6da29d2169a.png)
53+![TMap 8.2.2](https://user-images.githubusercontent.com/4276606/42494935-3a352d96-8454-11e8-985e-ebc77cc51ca0.png) | ![TMap 8.4.3](https://user-images.githubusercontent.com/4276606/42495147-d884bdf4-8454-11e8-887f-9815fd2b8d68.png)