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
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
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
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
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
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
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
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.
___
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.