You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While working with app's code I noticed that compilation times of some modules became significantly slower: not the biggest module in the world ~1500 lines, complied in ~5sec.
It turned out that the main reason for this was a large app's model type which is a type synonim record and functions that used that type.
I removed all signatures in the module of the app compilation times decreased twise to ~2sec. I wrapped the app's model in a newtype, and compilations times just dropped significantly.
It seems that it is not in the complex type itself, but type signatures that cause the slow down, the more signatures used the type the slower compilation times.
It probably refers to dealising process. If this issue exists with large types, it probably still contributes to compilation performance issues with less extensive types too.
To Reproduce
It is easy to reproduce, just need to emulate a large complex form with nested records.
moduleSlowwheretypeField={a01::Int
, a02::Int
, a02::Int-- some fields below}typeRec={field00::Field
, field01::Field
, field02::Field
, field03::Field
, field04::Field
, field05::Field-- some fields below}-- some functions that work with the record typefn1::Rec->Rec
fn1 model = model
-- if to remove signatures time dropsfn2::Rec->Rec
fn2 model = fn1 model
Description
While working with app's code I noticed that compilation times of some modules became significantly slower: not the biggest module in the world ~1500 lines, complied in ~5sec.
It turned out that the main reason for this was a large app's model type which is a type synonim record and functions that used that type.
I removed all signatures in the module of the app compilation times decreased twise to ~2sec. I wrapped the app's model in a
newtype
, and compilations times just dropped significantly.It seems that it is not in the complex type itself, but type signatures that cause the slow down, the more signatures used the type the slower compilation times.
It probably refers to dealising process. If this issue exists with large types, it probably still contributes to compilation performance issues with less extensive types too.
To Reproduce
It is easy to reproduce, just need to emulate a large complex form with nested records.
Here is the gist with the sample code:
https://gist.github.com/wclr/9abb95f623322a6c92635f436697660f
If to remove signatures that use this type or replace a synonym with a
newtype
compilation time drops significantly.I assume that this problem is known from practice (though I didn't see any active issues about it), want to draw some attention to it.
The text was updated successfully, but these errors were encountered: