Skip to content

refactor: replace chokidar with @parcel/watcher#72

Merged
RafaUC merged 1 commit into
RafaUC:masterfrom
pianissi:refactor/watcher-change
Oct 4, 2025
Merged

refactor: replace chokidar with @parcel/watcher#72
RafaUC merged 1 commit into
RafaUC:masterfrom
pianissi:refactor/watcher-change

Conversation

@pianissi
Copy link
Copy Markdown

This PR attempts to optimise the behaviour of file watching by replacing the watcher from chokidar to @parcel/watcher which uses native file watching methods.

Caveats:

  • Works best with Watchman installed but I am not sure on how to package the Watchman binary
  • Only tested on Windows
  • "ready" event doesn't exist, therefore it doesn't scan the entire directory before watching / subscribing to updates
  • I have 0 clue how to actually package an external module into electron-builder so I modified package.json to include @parcel/watcher's node modules in the build.

Would probably be good to test more to see if it works for everyone, since I didn't do much testing other than basic functions. Seems to work well when I import and delete 10k images in one go.

@Antoine-lb
Copy link
Copy Markdown

@pianissi What is the motivation behind changing that package?

@pianissi
Copy link
Copy Markdown
Author

Mainly performance and startup time. When I was using the app with around 100k - 200k images it would spend around 5-15 minutes scanning for files on startup, which seemed to be chokidar crawling through directories. It also seemed to be a point of concern in previous issues in the original project (allusion-app#423) in terms of the limit of how many files would be able to be watched. I think this is less of a problem now since the feature to selectively choose which locations to sync was added, but with @parcel/watcher it should be a bit better because of the native backends and batched events.

It also has the ability to query for historical changes to not need crawling through the directories on startup which is something I haven't tested.

Lemme know your thoughts, since I just tried it out to see if it worked. However, there is an issue with this commit with it opening the terminal every time the watcher subscribes to events which I'm not sure about how to fix.

@Antoine-lb
Copy link
Copy Markdown

Sounds like a great idea. I'm not one of the developers of these projects, so I can't help you more than that.

@RafaUC
Copy link
Copy Markdown
Owner

RafaUC commented Oct 4, 2025

This works great, it is so much faster now, thanks!

@RafaUC RafaUC merged commit 7a9afb8 into RafaUC:master Oct 4, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants