简体   繁体   中英

grunt watch using lots of cpu on Ubuntu 12.04

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM