{"id":26949631,"url":"https://github.com/catdad-experiments/filewatch-benchmarks","last_synced_at":"2025-08-03T19:14:04.123Z","repository":{"id":40734058,"uuid":"200576134","full_name":"catdad-experiments/filewatch-benchmarks","owner":"catdad-experiments","description":null,"archived":false,"fork":false,"pushed_at":"2022-12-05T20:50:13.000Z","size":394,"stargazers_count":1,"open_issues_count":10,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-04-10T15:07:31.943Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://dev.to/catdad/what-happens-when-you-can-no-longer-trust-your-file-watcher-15d8","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/catdad-experiments.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-08-05T03:31:30.000Z","updated_at":"2022-07-02T18:08:18.000Z","dependencies_parsed_at":"2023-01-24T06:46:13.087Z","dependency_job_id":null,"html_url":"https://github.com/catdad-experiments/filewatch-benchmarks","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catdad-experiments%2Ffilewatch-benchmarks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catdad-experiments%2Ffilewatch-benchmarks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catdad-experiments%2Ffilewatch-benchmarks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catdad-experiments%2Ffilewatch-benchmarks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/catdad-experiments","download_url":"https://codeload.github.com/catdad-experiments/filewatch-benchmarks/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246899656,"owners_count":20851899,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-04-02T22:16:50.668Z","updated_at":"2025-04-02T22:16:51.103Z","avatar_url":"https://github.com/catdad-experiments.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# file watching benchmarks\n\n[![Travis Build Status](https://travis-ci.com/catdad-experiments/filewatch-benchmarks.svg?branch=master)](https://travis-ci.com/catdad-experiments/filewatch-benchmarks)\n[![Azure Pipelines Build Status](https://dev.azure.com/vatev1/filewatch-benchmarks/_apis/build/status/catdad-experiments.filewatch-benchmarks?branchName=master)](https://dev.azure.com/vatev1/filewatch-benchmarks/_build/latest?definitionId=1\u0026branchName=master)\n\nWith the [fanfare surrounding the release](https://paulmillr.com/posts/chokidar-3-save-32tb-of-traffic/) of [`chokidar@3.0.0`](https://github.com/paulmillr/chokidar), and the [subsequent](https://github.com/paulmillr/chokidar/issues/873) [long](https://github.com/paulmillr/chokidar/issues/860) [list](https://github.com/paulmillr/chokidar/issues/871) of [new bugs](https://github.com/paulmillr/chokidar/issues/865) which affected some of [my projects](https://github.com/catdad/electronmon), I decided to take a look at the issue of watching files. Long story short, [`watchboy`](https://github.com/catdad/watchboy) was born and he's magnificent!\n\nTo make sure that he's doing a good job watching after your files, I created this benchmark suite. While I wrote and ran it, I am making it available to everyone so that you can check my work. Feel free to run it and submit more test cases that you want to see compared. With that said, let's talk about results.\n\n_Note: all memory measurements were taken after garbage collection._\n\n## Test machines\n\nTests are run in Azure Pipelines, for repeatability. The following specs are used (I will simply be referring to these machines as Windows, Linux and MacOS below):\n\n| OS                                       | Processor                                 | Cores |\n| :---                                     | :---                                      | :---  |\n| Microsoft Windows Server 2019 Datacenter | Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz | 2     |\n| Ubuntu 16.04.6 LTS                       | Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz | 2     |\n| macOS 10.14.6                            | Intel(R) Xeon(R) CPU E5-1650 v2 @ 3.50GHz | 4     |\n\nNow, let's watch some popular projects and see what kind of results we get. In all cases, I have pinned the exact commit of each project, so that we always test the exact same files regardless of how these projects grow over time.\n\n## Watching the `react` source code (small project)\n\nThe pinned version of `react` contains 1,554 files in 292 directories.\n\n### Windows\n\n| Library    |  Ready In   |  Retained Heap  |  Retained RSS  |\n| ---        | ---:        | ---:            | ---:           |\n| `chokidar` |  1286.68ms  |  35.3 MB        |  48 MB         |\n| `gaze`     |  1006.31ms  |  16 MB          |  15.5 MB       |\n| `watchboy` |  290.58ms   |  15.9 MB        |  19.3 MB       |\n\n### Linux\n\n| Library    |  Ready In  |  Retained Heap  |  Retained RSS  |\n| ---        | ---:       | ---:            | ---:           |\n| `chokidar` |  636.64ms  |  35.2 MB        |  43.3 MB       |\n| `gaze`     |  441.16ms  |  17.3 MB        |  17.2 MB       |\n| `watchboy` |  262.26ms  |  16 MB          |  19 MB         |\n\n### MacOS\n\n| Library    |  Ready In  |  Retained Heap  |  Retained RSS  |\n| ---        | ---:       | ---:            | ---:           |\n| `chokidar` |  271.03ms  |  15.9 MB        |  21.2 MB       |\n| `gaze`     |  639.29ms  |  17.6 MB        |  15.2 MB       |\n| `watchboy` |  287.46ms  |  16.6 MB        |  20.8 MB       |\n\n## Watching the `vscode` source code (medium project)\n\nThe pinned version of `vscode` contains 4,396 files in 1,399 directories.\n\n### Windows\n\n| Library    |  Ready In   |  Retained Heap  |  Retained RSS  |\n| ---        | ---:        | ---:            | ---:           |\n| `chokidar` |  4063.48ms  |  53.3 MB        |  90.5 MB       |\n| `gaze`     |  3221.65ms  |  38.7 MB        |  63.4 MB       |\n| `watchboy` |  868.90ms   |  19.5 MB        |  21.5 MB       |\n\n### Linux\n\n| Library    |  Ready In   |  Retained Heap  |  Retained RSS  |\n| ---        | ---:        | ---:            | ---:           |\n| `chokidar` |  1787.42ms  |  52 MB          |  65.7 MB       |\n| `gaze`     |  1074.02ms  |  43.7 MB        |  55.5 MB       |\n| `watchboy` |  846.60ms   |  31.2 MB        |  25.7 MB       |\n\n### MacOS\n\n| Library    |  Ready In   |  Retained Heap  |  Retained RSS  |\n| ---        | ---:        | ---:            | ---:           |\n| `chokidar` |  717.89ms   |  39.2 MB        |  49.1 MB       |\n| `gaze`     |  1531.37ms  |  39.3 MB        |  48.2 MB       |\n| `watchboy` |  717.92ms   |  34.7 MB        |  23.8 MB       |\n\n## Watching the `babel` source code (large project)\n\nThe pinned version of the `babel` source code is pretty diabolical. It contains 16,528 files in 8,216 directories. I actually had to disqualify `gaze` from this benchmark because it throws a `Maximum call stack size exceeded` when trying to watch all files.\n\n### Windows\n\n| Library    |  Ready In    |  Retained Heap  |  Retained RSS  |\n| ---        | ---:         | ---:            | ---:           |\n| `chokidar` |  18936.22ms  |  164 MB         |  304 MB        |\n| `watchboy` |  7408.11ms   |  49.2 MB        |  54.2 MB       |\n\n### Linux\n\n| Library    |  Ready In   |  Retained Heap  |  Retained RSS  |\n| ---        | ---:        | ---:            | ---:           |\n| `chokidar` |  7728.19ms  |  181 MB         |  208 MB        |\n| `watchboy` |  6865.25ms  |  63.5 MB        |  70.9 MB       |\n\n### MacOS\n\n| Library    |  Ready In   |  Retained Heap  |  Retained RSS  |\n| ---        | ---:        | ---:            | ---:           |\n| `chokidar` |  2957.61ms  |  67 MB          |  97.6 MB       |\n| `watchboy` |  5524.79ms  |  51.1 MB        |  59.9 MB       |\n\n## Watching a single large directory\n\nThis case is not necessarily common in software, but is common with other use cases. For a [photography application] I maintain, it is not all that rare to open a single directory with several hundred to a couple thousand photos that you took on a single day or single trip. In this benchmark, we'll watch a 1 directory containing 2000 files.\n\n### Windows\n\n| Library    |  Ready In    |  Retained Heap  |  Retained RSS  |\n| ---        | ---:         | ---:            | ---:           |\n| `chokidar` |  899.83ms    |  36.9 MB        |  49.2 MB       |\n| `gaze`     |  31861.00ms  |  15.2 MB        |  12.9 MB       |\n| `watchboy` |  172.60ms    |  13.6 MB        |  17.8 MB       |\n\n### Linux\n\n| Library    |  Ready In    |  Retained Heap  |  Retained RSS  |\n| ---        | ---:         | ---:            | ---:           |\n| `chokidar` |  432.60ms    |  37.5 MB        |  44.7 MB       |\n| `gaze`     |  42522.20ms  |  15.3 MB        |  22.1 MB       |\n| `watchboy` |  146.25ms    |  13.6 MB        |  19.8 MB       |\n\n### MacOS\n\n| Library    |  Ready In    |  Retained Heap  |  Retained RSS  |\n| ---        | ---:         | ---:            | ---:           |\n| `chokidar` |  225.75ms    |  16.9 MB        |  22.5 MB       |\n| `gaze`     |  52723.25ms  |  8.65 MB        |  12.3 MB       |\n| `watchboy` |  213.00ms    |  15.9 MB        |  21.3 MB       |\n\n## Memory footprint\n\nThis one is more for fun, but I wanted to see how much memory is needed to simply require each module and have it be present at runtime. Here's the breakdown:\n\n| Library    | Windows size | Linux size | MacOS size |\n| ---------- | ---:         | ---:       | ---:       |\n| `chokidar` | 1.63 MB      | 1.59 MB    | 2.34 MB    |\n| `gaze`     | 3.29 MB      | 2.45 MB    | 4.99 MB    |\n| `watchboy` | 1.56 MB      | 1.75 MB    | 2.14 MB    |\n\n## Download size\n\nAn extension of the footprint, this metric measures how many files are installed as a result of each dependency, as well as the total size of each dependency.\n\n| Library | Packages | Directories | Files | Total size |\n| --- | ---: | ---: | ---: | ---: |\n| `chokidar` (Windows) | 14 | 18 | 78   | 339 kB |\n| `chokidar` (MacOS)   | 15 | 19 | 83   | 374 kB |\n| `gaze`               | 14 | 19 | 1111 | 1.6 MB |\n| `watchboy`           | 12 | 15 | 72   | 342 kB |\n\n## Run the benchmarks yourself\n\nThe results presented here are from [pipeline runs in Azure Pipelines](https://dev.azure.com/vatev1/filewatch-benchmarks/_build/latest?definitionId=1\u0026branchName=master). There are [pipelines in Travis-CI](https://travis-ci.com/catdad-experiments/filewatch-benchmarks) as well, showing comparable results. You can also run them yourself on your own machine if you'd like:\n\n```bash\ngit clone https://github.com/catdad-experiments/filewatch-benchmarks.git\ncd filewatch-benchmarks\nnpm install\n\n# run all benchmarks\nnpm start\n\n# get the names of all available benchmarks\nnpm run testlist\n\n# run only a single test from the above list\nnpm start -- \u003ctest name\u003e\n```\n\nAll the tests themselves are defined in the `benchmarks` directory.\n\nThe benchmarks are powered by [`grandma`](https://github.com/catdad/grandma). If you want to see a different test, feel free to add it and send me a PR.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcatdad-experiments%2Ffilewatch-benchmarks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcatdad-experiments%2Ffilewatch-benchmarks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcatdad-experiments%2Ffilewatch-benchmarks/lists"}