3 ms·
While I've found that Haskell's laziness can often be worked around with appropriately-implemented memoization, it's an absolute PITA for anything that requires
by verandaguys_alt 9y ago
While I've found that Haskell's laziness can often be worked around with appropriately-implemented memoization, it's an absolute PITA for anything that requires frequent hops into the IO monad (unsurprisingly). Historically, this has been a bottleneck for me that's prevented me from using Haskell in any major projects.
A Haskell port of a logging library I'd originally written in Python ended up being almost 2 orders of magnitude slower than CPython 3, and almost 3 orders of magnitude slower than PyPy3.
PyPy3 resulted in performance similar to a barely-optimized C port.
- vmchale 9y agoDo you have source code? It sounds like you were writing unidiomatic Haskell.
- verandaguys_alt 9y agoI actually posted the port on the Code Review SE, where (after almost a month of silence), someone stepped up and offered a CFFI solution. https://codereview.stackexchange.com/questions/157118/a-port-of-a-simple-logger https://codereview.stackexchange.com/questions/157118/a-port...
- vmchale 9y agoYou might have better luck with the fast-logger library, for one. I'd also suggest using ansi-wl-pprint, which would work on Windows and also probably be faster than string concatenation (which is just plain bad in Haskell). As was pointed out, GHC is calling getCurrentTime too often. If you take advantage of GHC's laziness, the value will stay valid longer. I assume that is what fast-logger does. https://hackage.haskell.org/package/fast-logger https://hackage.haskell.org/package/fast-logger