How efficient is Chokidar (Node.js)?

大兔子大兔子 提交于 2019-12-03 06:27:37

Chokidar's efficiency depends on which operating system it's running on.

On OS X, it uses a module that provides access to the native fsevents API, which is extremely efficient.

On other systems, it uses node.js's fs.watch or fs.watchFile APIs. Under the hood, fs.watch uses various system APIs to be notified of changes, which may be reasonably efficient. fs.watchFile uses stat polling, which would definitely be inappropriate for directories as large as you're describing.

My suggestion is that you set the chokidar option usePolling: false and give it a try, monitoring your cpu load.

Update (July 2015): Chokidar has been substantially improved since this was originally written, and polling is no longer the default on any platform.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!