shama/gaze

Add fsevent support using `bin/fsevent_watch` executable

lancejpollard opened this issue · 5 comments

Hey,

I am very excited about your gaze module and your solution to the watcher issues with node/grunt.

One thing is though, watching large directories using fs.watch - even with all the improvements gaze has made - is still very processor intensive (on a Mac at least).

The solution to this problem is using FSEvent on the Mac. You can easily do that by downloading the following binary from the ruby rb-fsevent project:

https://github.com/thibaudgg/rb-fsevent/blob/master/bin/fsevent_watch

Detailed usage information here:

guard/rb-fsevent#38 (comment)

By integrating this FSEvent binary for Mac users, CPU usage stays well below 1% even on enormous directories. Currently fs.watch (using gaze, chokidar, or others) hits the CPU hard. For modest sized git repos (watching at the root, such as on the Tower.js project to compile coffeescripts), it uses more than 75% while the watch process is running.

Is this something you're interested in? I can help integrate if desired, let me know. Thanks!

Yes totally. I've only briefly looked in fsevent but looked very promising. Help on this would be very much appreciated.

FWIW, I'd prefer fsevent implemented as a native binding (and a separate lib). I'm still new to bindings so don't expect anything soon. ;)

It appears FSEvents have landed in node v0.9.2. Here is the implementation.

Closing as it appears this has landed into node. :D

Awesome :D