reason icon indicating copy to clipboard operation
reason copied to clipboard

Refmt can be extremely slow

Open gaku-sei opened this issue 4 years ago • 5 comments

The issue start occuring when refmt is used on "many" files (> 500):

Capture d’écran 2020-03-06 à 16 49 06

(Notice that I'm using the bsrfmt wrapper in the screenshot above).

Tested on a mac pro, with 16go of ram and a [email protected].

Notice that this also has a pretty big impact on the extensions using refmt under the hood to reformat the files on save.

gaku-sei avatar Mar 06 '20 07:03 gaku-sei

Do you have a repo with a case to reproduce this behaviour?

IwanKaramazow avatar Mar 06 '20 08:03 IwanKaramazow

@gaku-sei is the total time more than the sum of the times, if files are formatted individually?

cristianoc avatar Mar 06 '20 09:03 cristianoc

@gaku-sei Do you have the same behaviour when doing find -name '*.re' | xargs bsrefmt --in-place?

bloodyowl avatar Mar 06 '20 09:03 bloodyowl

Thank you guys for you replies. The above command (and the one submitted by @bloodyowl ) both give the same results. It's most of the time fast, around half a second, but sometimes go crazy (as above) for no reason 😕

Also, i thought it was the reason why vs code was hanging when saving a file (since the https://github.com/jaredly/reason-language-server extension runs refmt under the hood), but it could be related to an other issue: https://github.com/jaredly/reason-language-server/issues/423

gaku-sei avatar Mar 13 '20 09:03 gaku-sei

@gaku-sei there must then be a couple of slow files. That would be a more concrete repro, than the whole 500.

cristianoc avatar Mar 13 '20 09:03 cristianoc