avh4 / elm-format

elm-format formats Elm source code according to a standard set of rules based on the official Elm Style Guide
BSD 3-Clause "New" or "Revised" License
1.31k stars 148 forks source link

Performance drops exponentially with deeply nested lists #778

Open kraklin opened 2 years ago

kraklin commented 2 years ago

Hey,

we have found a possible performance bug with our code - one of our BE engineers copy/pasted deeply nested HTML structure and suddenly the elm-format takes 20s on 500 lines file. We were able to narrow the problem to having deeply nested lists - I have created SSCCE for it here:

https://github.com/kraklin/elm-format-nesting-bug-sscce

Current way around is to split those deeply nested lists into several functions once it exceeds cca 10 levels of nested lists.

avh4 commented 2 years ago

Can you confirm which version of elm-format you're using, so make sure you're not seeing https://github.com/avh4/elm-format/issues/642 ?

Side-note that this might be similar to https://github.com/avh4/elm-format/issues/753

kraklin commented 2 years ago

Latest version - 0.8.5 it is fixed in the elm-tooling in the SSCCE repository.

Regarding the other problems - this is replicable with lists of one element containing list of one element... so I'd say the length of the list or size of the file does not play any role with this one.