tamasfe / taplo

A TOML toolkit written in Rust
https://taplo.tamasfe.dev
MIT License
1.26k stars 108 forks source link

`taplo-cli` very slow at collecting files #619

Open drahnr opened 2 weeks ago

drahnr commented 2 weeks ago

Our project grew and taplo evolved. Trying 0.9.0 and 0.9.1 (unreleased, git) both exhibit a rather slow glob resolution and file collection. It hangs for minutes.

EDIT: it doesn't finish collecting the files at all

panekj commented 2 weeks ago

It's hard to act in any way without details about the project, how many files, how is taplo used, etc.

drahnr commented 2 weeks ago

I think it be great to have some addition tracing::trace! level logs in there.

I added some and it turns out self.env.glob_files_normalized(&pat) doesn't return but gets hung up. There are 71 files that match the regex ^.+\.toml$, the repository contains 5 symlinks, 0 of them are toml files.

drahnr commented 2 weeks ago

After deleting my arguably hefty target dir, it goes back to normal.

tl;dr it might make sense to honour .gitignore if present to avoid scanning temporary build directories.

panekj commented 2 weeks ago

We already have an exclude configuration option that can resolve that. Reading .gitignore might introduce unwanted behaviour of not formatting files that are ignored but not expected to be.

drahnr commented 2 weeks ago

Well, know I have to define two places where I have globs of ignores. I personally find that more unexpected vs taking into account .gitignore files.