elm-format
elm-format copied to clipboard
formatting is slow (~1 minute) for large (~5000 elements) lists
While greatly improved by https://github.com/avh4/elm-format/issues/642, something is still slow for large lists. Two Elm Slack users have noted that files with ~5000 element literal lists can take more than a minute to format.
help wanted note: At this point, and help starting to debug the problem would be helpful. Here are some possible ideas that might lead to useful information:
- record formatting times for files with lists of different lengths: does time increase linearly, quadratically, etc?
- run with profiling enabled: is the slow part in parsing or in formatting? where are the hotspots? (I'd guess most likely there is backtracking happening as a result of how comments are being parsed which is maybe the root of the issue, but it would be good to get this confirmed)
- does memory use increase along with run time?
Something else interesting to check would be to try the equivalent source file with gren format
on https://github.com/gren-lang/compiler/pull/154/commits/439e38f13188a99ad0b77975e3d3c8dfdba98cf5 since it uses the Elm 0.19 parser -- if that deals with it better, then continuing the conversion of elm-format to the new parser might be the most efficient way to improve this.