Question

I'm using grunt to watch my coffeescript files in a towerjs project and recompile them as they change. The configuration for this is generated by towerjs and seems fairly sane. The problem is, that once I start this process I will see it pegging a cpu core (actually, just one hyperthread). If I remove a lot of the paths from being watched I can get it down to around 25% of a CPU, but that is still pretty terrible.

I've found a few references to some known issues and cross-platform inconsistence with the Node's fs API and even the fs.watch in particular. Tried grunt-simple-watch but it did not do any better.

I could setup Guard but it may be fiddlesome to get it working just right and functionally grunt seems to be just fine - I am curious though if anyone else has any other suggestions.

Was it helpful?

Solution

Give the new watch task a try: npm install grunt-contrib-watch and add grunt.loadNpmTasks('grunt-contrib-watch'); to your gruntfile. The Grunt v0.3 watch task traverses & stats files which with a large number of files can get slow but was necessary for system compatibility. The new one will only use inotify if working properly within node.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top