git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Watchman support for git

From
dturner@twopensource.com <dturner@twopensource.com>
Date
May 2, 2014, 23:14 UTC
Message-ID
<1399072451-15561-1-git-send-email-dturner@twopensource.com>

The most sigificant patch uses Facebook's watchman daemon[1] to monitor the repository work tree for changes. This makes allows git status to avoid traversing the entire work tree to find changes.

This change requires libwatchman[2], a client library that I wrote for watchman.

While making the watchman change, I also made a change to the index format (contributed here in a separate patch). Index integrity checking uses the same SHA1 algorithm as the rest of git; this is actually relatively slow. It's not a huge part of run-time, but since I wanted to do the same checking for the Watchman filesystem cache (which is about twice as large as the index), I decided to optimize it anyway. I switched to VMAC. VMAC is supposed to be a MAC, but there's no reason it can't be used with a fixed key as a simple integrity check. VMAC is roughly five times faster than SHA1 on my machine; This adds up to a 5% overal speed improvement on git status (depending on the structure of your repo, and about 15% on git diff --cached with no cached changes).

The index format change might be less important with the split index; I haven't investigated that since at the time I wrote these patches, it didn't exist.

Some numbers follow. They are on my laptop, which has 4x i5-2520M processors, 8GB of RAM, and a solid state disk. They're all tested with a hot cache.

Test repository 1: Linux

Linux is about 45k files in 3k directories. The average length of a filename is about 32 bytes.

Git status timing: no watchman: 125ms watchman: 90ms

Test repository 2: Superscience

My second test repository (which is a semi-synthetic repo generated from various Twitter internal repos) is somewhat larger than this, and gets a correspondingly larger improvement. It is about 65k files in 20k directories; the average length of a filename is 67 bytes.

Git status timing: no watchman, index version 4: 370 ms no watchman, index version 5: 365 ms watchman, index version 4: 170 ms watchman, index version 5: 165 ms

[1] https://github.com/facebook/watchman [2] https://github.com/twitter/libwatchman

Next: dturner@twopensource.com
Message 1 of 43 in “Watchman support for git”
  1. dturner@twopensource.comMay 2, 2014
  2. 1/3 After chdir to run grep, return to old directorydturner@twopensource.com, May 2, 2014
  3. Junio C HamanoMay 6, 2014
  4. David TurnerMay 7, 2014
  5. Jeff KingMay 7, 2014
  6. David TurnerMay 7, 2014
  7. Junio C HamanoMay 7, 2014
  8. David TurnerMay 7, 2014
  9. 3/3 Watchman supportdturner@twopensource.com, May 2, 2014
  10. Felipe ContrerasMay 2, 2014
  11. David TurnerMay 3, 2014
  12. Felipe ContrerasMay 3, 2014
  13. David TurnerMay 5, 2014
  14. Felipe ContrerasMay 5, 2014
  15. Sebastian SchuberthMay 8, 2014
  16. David LangMay 9, 2014
  17. David TurnerMay 9, 2014
  18. David LangMay 9, 2014
  19. David TurnerMay 9, 2014
  20. David LangMay 9, 2014
  21. David TurnerMay 9, 2014
  22. Duy NguyenMay 3, 2014
  23. David TurnerMay 3, 2014
  24. Duy NguyenMay 3, 2014
  25. David TurnerMay 3, 2014
  26. Duy NguyenMay 4, 2014
  27. David TurnerMay 6, 2014
  28. Duy NguyenMay 6, 2014
  29. Duy NguyenMay 6, 2014
  30. Duy NguyenMay 10, 2014
  31. David TurnerMay 10, 2014
  32. Duy NguyenMay 11, 2014
  33. David TurnerMay 11, 2014
  34. Duy NguyenMay 12, 2014
  35. David TurnerMay 13, 2014
  36. Duy NguyenMay 13, 2014
  37. David TurnerMay 13, 2014
  38. Duy NguyenMay 10, 2014
  39. David TurnerMay 13, 2014
  40. Duy NguyenMay 14, 2014
  41. Duy NguyenMay 14, 2014
  42. David TurnerMay 15, 2014
  43. Duy NguyenMay 19, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.