prettier/tests/performance
Christopher Chedeau 8def8e13b0 Add caching for printing (#2259)
* Add caching for printing

For printing the last argument expansion, we need to print the same node a bit differently with a flag. It's not easy to re-print just the node that is different so we end up printing all the sub-tree twice. Since it is often nested, it means that we run into an exponential complexity.

I finally found a simple solution: we can use a Map to store the nodes and their printed values. It is really cheap to do so (I can't notice a time difference with or without on normal code) and allows us to stop going through the two sub-trees in the bad case.

Fixes #1250

* Update printer.js
2017-06-24 14:01:02 -07:00
..
__snapshots__ Add caching for printing (#2259) 2017-06-24 14:01:02 -07:00
jsfmt.spec.js test(typescript): enable typescript-verify on most tests (#1781) 2017-05-27 17:57:07 -07:00
nested-real.js Bail when traversing === groups (#1294) 2017-04-18 08:39:47 -07:00
nested.js Add caching for printing (#2259) 2017-06-24 14:01:02 -07:00