pakoito
03/02/2020, 10:55 AMPhBastiani
03/02/2020, 1:46 PMpakoito
03/02/2020, 2:28 PMpakoito
03/02/2020, 2:28 PMfx
relies on reflection, it's specially slow on AndroidJannis
03/02/2020, 3:34 PMFreeT
to arrow and benchmark it against coroutines and IO
. FreeT
together with f ~ EitherPartialOf<Throwable>
is equal to kotlin coroutines. Wonder where that would lead^^ Likely worse atm, but with actual newtypes this might even be able to compete. Although this would likely end up being a benchmark of the interpreter/runloop/scheduler instead of actual programs as soon as the programs grow in size. Definitely something that I will test some day^^Jannis
03/02/2020, 7:33 PMAndThen
and IO
. (Not sure if AndThen
works in that context but it should). Would be interesting to see how those compare.Jannis
03/02/2020, 7:37 PMCofree
and Option
. It is not a good benchmark target though because a histomorphism automatically caches prior results with a shapeshifting cache (Cofree
+ Option
provide a linked list cache, Cofree
+ ListK
would provide a tree and so on. Basically every functor that you combine with Cofree
provides a different sort of cache). If you want to see how that works, here is the example: https://github.com/arrow-kt/arrow-incubator/blob/master/arrow-recursion-data/src/main/kotlin/arrow/recursion/typeclasses/Recursive.kt#L191Jannis
03/02/2020, 7:44 PMhistoM
version is stacksafe (by using Eval
, or any other stacksafe M
). But because this does so little work it takes a while to overflow it. Also the stacksafe variant provides some stupid results as soon as it overflows long numbers, but it's really fast^^PhBastiani
03/03/2020, 10:09 AMhistoM
sample out to me.
About `AndThen`: I don't know... because of the lack of a deferred method. For sure we could segment or memoize some parts of the recursive algo.Jannis
03/03/2020, 10:19 AMAndThen
isn't really that important. I think it is possible to run it, but you'd have to vary the implementation a bit. IO
would be interesting to see though. The histo version is probably a lot faster than anything else, but that is because of the implementation and not the datatype.Jannis
03/03/2020, 10:30 AMevalFib(n).value()
it will not memoize a thing. (unless the jvm does it's magic, but I don't think that is the case)