faylang / fay

A proper subset of Haskell that compiles to JavaScript
https://github.com/faylang/fay/wiki
BSD 3-Clause "New" or "Revised" License
1.29k stars 89 forks source link

uniplate made fay unusable #370

Closed osa1 closed 10 years ago

osa1 commented 10 years ago

Please revert uniplate patches. I know it improved desugar module significantly, but it also made fay unusable on my system.

At first I thought there is a bug and fay is stuck in an infinite loop or something, because it was consuming all RAM and swap. (I have 6gb RAM and 2gb swap, but some other programs were also running)

I tried to trace the bug, but there was no bug. Starting from 3533944 , uniplate is more widely used in every commit. And in every commit there's significant performance loss and significant increase in memory.

With current master, fay is practically unusable.

Here's a demonstration:

➜  examples git:(master) ✗ time fay canvaswater.hs
fay canvaswater.hs  16.39s user 0.73s system 99% cpu 17.261 total
➜  examples git:(master) ✗ git checkout 7bcc45a
... run cabal build etc. ...
➜  examples git:(7bcc45a) ✗ time fay canvaswater.hs
fay canvaswater.hs  0.65s user 0.06s system 98% cpu 0.715 total

This is horrible. I knew syb and friends are slow, but I didn't expect them to be that slow. And memory consumption is even worse, because my system becomes frozen while fay is running, since ram + swap is full. Please revert this patches otherwise I can't use fay anymore.

bergmark commented 10 years ago

What GHC version are you using? I wasn't able to reproduce this

> time fay examples/canvaswater.hs
        0.84 real         0.76 user         0.06 sys
osa1 commented 10 years ago
➜  examples git:(master) ✗ ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.6.3
➜  examples git:(master) ✗ ghc-pkg list | grep uniplate
WARNING: there are broken packages.  Run 'ghc-pkg check' for more details.
    uniplate-1.6.10
    uniplate-1.6.12
➜  examples git:(master) ✗ ghc-pkg list | grep syb     
WARNING: there are broken packages.  Run 'ghc-pkg check' for more details.
    syb-0.3.7
    syb-0.4.0
    syb-0.4.1
    syb-with-class-0.6.1.4
bergmark commented 10 years ago

This should be it, i was able to reproduce your problem with uniplate 1.6.10.

1.6.11
    Work around more excessive strictness, gives 10x speed improvement
bergmark commented 10 years ago

This solved it for me, please verify!

osa1 commented 10 years ago

Yeah, that solved it. Thanks.