cli icon indicating copy to clipboard operation
cli copied to clipboard

`config` traversing the entire project paths and reading every single file

Open f0o opened this issue 2 years ago • 2 comments

Ask your Question

Hi,

I noticed config being called by gradle and it being seemingly stuck so I issued the command through strace and saw that it opens EVERY SINGLE FILE that exists in the repo (regardless of type) which obviously takes a very very very very very very very very long time in some cases (specially when using gradle's --build-cache ).

So the Question is: Why? Why is it doing that to construct an object that lists perhaps 20 paths?

Is there no way to filter this and make it more optimized? it seems to only post things starting with react-native-* yet accesses every single module and project file in existence for that.

The sheer amount of statx() calls isnt even the issue but the fact that it opens and reads from them makes it particularly fun when it opens binary files or APK artifacts...

Is this really by design??

f0o avatar Jun 07 '22 13:06 f0o

It's just unoptimized. We'll welcome any kind of improvements, like caching or better resolution strategy as a PR :)

thymikee avatar Jun 07 '22 14:06 thymikee

Happy to, just trying to find the culprit here. Right now I'm "solving" it by nuking node_modules after every build and reinstalling things.

//Edit: Right so even before config.js is being called the sole creation of the ctx object takes 30s already... the filterConfig bloats that up to 1:21m JSON.stringify then goes on and calls all getters to double that time having a final 2:30-3m execution time... That's just insane... Specially considering that this is being called multiple times by gradle..

//Edit2: With any form of caches the time it takes ramps up to staggering 18-20 minutes per execution.

f0o avatar Jun 07 '22 14:06 f0o

There hasn't been any activity on this issue in the past 3 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 7 days.

github-actions[bot] avatar Nov 25 '22 03:11 github-actions[bot]