Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #642 Bad performance/memory leak for long list literals
A one-character fix that speeds up the formatting of long literals and drastically reduces memory usage. A very simple example is ```elm module Small exposing (x) x = [ 1, 2, 3 , 4] ``` But with a list literal of many thousands of elements. The newline forces all elements to get their own line. This is implemented as a fold, but in practice this would often perform ``` longList ++ shortList ``` By reversing the fold (from `foldl` to `foldr`) that turns into ``` shortList ++ longList ``` Which requires less traversals and memory.
- Loading branch information