Urthen / case-sensitive-paths-webpack-plugin

Enforces case sensitive paths in Webpack requires.
MIT License
428 stars 45 forks source link

Very long build times #5

Closed mzedeler closed 8 years ago

mzedeler commented 8 years ago

After switching on this module, we've experienced that the build time increased from less than two seconds to around 15. The consequence is that we can't really use this module.

Are we doing something wrong or is it because the module doesn't handle large projects too well?

Urthen commented 8 years ago

It does currently check every single directory of every single file you're building, including duplicates. If that is a large number I imagine it'll probably become slow.

I might be able to do two things to speed it up:

  1. Cache directories it has already checked and knows the case of, this should reduce the number of file system operations drastically since currently it checks all the way back to root. Eliminating the need to check the entire directory tree up to your project directory on every file should speed things up.
  2. It currently checks directories synchronously. Splitting up the path and checking each one async will probably save some time as well.

I don't have a timeframe on those, unfortunately - under my own deadline at work, but maybe this weekend.

Urthen commented 8 years ago

I was able to add a simple caching system to the plugin which dramatically reduces the number of filesystem operations required. Our project required 25,628 path.fsreaddirSync calls from this plugin. With the changes, that's down to 278 - nearly a 100x reduction, far better than even I imagined.

I've published v1.1.0 to NPM. Please let me know if it helps!

mzedeler commented 8 years ago

Great! I'll take a look.

Urthen commented 8 years ago

I've pushed a patch (1.1.1) which resolves an issue related to the cache becoming stale when used in a hot-reloader.

Any luck with build time reductions?

vipcxj commented 5 years ago

It's still very very slow, it even took more time than UglifyJsPlugin.

mzedeler commented 5 years ago

I'm sorry for not getting back to you @Urthen - I am on Linux and the coworkers on my team with Mac lost interest and removed the module :-/

Anyway - I am on a new team now and one of the new team members is complaining about case sensitive file names on MacOS, so obviously I've asked her to try this module.