Re: [Haskell] ANNOUNCE: mm2: The library that can be used for optimization of multiple (Ord a) => a -> b transformations

2019-09-21 Thread olexandr543--- via Haskell
I did not check the code for 'case ... of ...' constuction in GHC, my intention comes from the explanations how this construction works in Haskell in some teaching materials.So, definitely I should do more exploratory work. Nevertheless, the type signatures and sorting is realized for rather ge

Re: [Haskell] ANNOUNCE: mm2: The library that can be used for optimization of multiple (Ord a) => a -> b transformations

2019-09-21 Thread olexandr543--- via Haskell
Yes, you can use IntMap. It needs another dependency and the complexity choice as O(log (min (n, W))) where W is a number of bits in a representing key, used for mapping.  For me, it is rather hard to solve whether it can be better, because it raises another problem of efficient binary represen

Re: [Haskell] ANNOUNCE: mm2: The library that can be used for optimization of multiple (Ord a) => a -> b transformations

2019-09-21 Thread Bryon Tjanaka
At any rate, using binary search doesn’t automatically guarantee faster runtime. Constant factors can add up, and there might not even be enough elements to warrant binary search. Benchmarking on realistic data is definitely a good idea. On Sat, Sep 21, 2019 at 11:39 AM David Feuer wrote: > Case

Re: [Haskell] ANNOUNCE: mm2: The library that can be used for optimization of multiple (Ord a) => a -> b transformations

2019-09-21 Thread Georgi Lyubenov
case_of_ in Haskell should be constant - Your constructors are ints, you know in advance how many there are, so you can just jump with an offset? (I haven't actually checked this, but it doesn't seem unreasonable to me, that this would be the implementation) === Georgi

Re: [Haskell] ANNOUNCE: mm2: The library that can be used for optimization of multiple (Ord a) => a -> b transformations

2019-09-21 Thread David Feuer
Case matching is already optimized in GHC. There might be ways to improve it, but it already uses binary search and/or jump tables to improve performance when there are many branches. On Sat, Sep 21, 2019, 8:59 AM olexandr543--- via Haskell < haskell@haskell.org> wrote: > Hello! > > My library th

Re: [Haskell] ANNOUNCE: mm2: The library that can be used for optimization of multiple (Ord a) => a -> b transformations

2019-09-21 Thread olexandr543--- via Haskell
Hello! Matthew, no, I don't benchmark this library, it should be more sufficient theoretically because it uses binary search rather than linear, and the first one is known to be more efficient. I used the similar technique for writing code for my project mm1. There I firstly used case but then

Re: [Haskell] ANNOUNCE: mm2: The library that can be used for optimization of multiple (Ord a) => a -> b transformations

2019-09-21 Thread Matthew Pickering
Have you benchmarked this library? I don't see how using a vector can be any faster than using a case. On Sat, 21 Sep 2019, 14:00 olexandr543--- via Haskell, wrote: > Hello! > > My library that can help to optimize using 'case ... of ...' construction > if there are multiple (more than at least

[Haskell] ANNOUNCE: mm2: The library that can be used for optimization of multiple (Ord a) => a -> b transformations

2019-09-21 Thread olexandr543--- via Haskell
Hello! My library that can help to optimize using 'case ... of ...' construction if there are multiple (more than at least 5) variants.mm2: The library that can be used for optimization of multiple (Ord a) => a -> b transformations Best regards,Oleksandr Zhabenko. ___

[Haskell] ANNOUNCE: mm2 -- the library that can be used for optimization of multiple (Ord a) => a -> b transformations

2019-09-21 Thread olexandr543--- via Haskell
Hello! My library that can help to optimize usage of the 'case ... of ...' construction if there are multiple (more than at least 5) variants is published on Hackage.mm2: The library that can be used for optimization of multiple (Ord a) => a -> b transformations Best regards,Oleksandr Zhabenko.