First time contributor here, trying my first git.git patch series. BACKGROUND We have a script that runs a range of build tests for all new commits in the repository and adds a line to the commit note with the result from the test. Something along the lines of: occa-build-jit-gnu-cuda-develop: PASSED (<hostname>, 2024-01-01 00:00:00+01:00) Pretty useful to quickly check that all commits at least build, not only for master, but also in progress feature branches. (a passing test suite is generally only required at the merge point) PROBLEM The bash script loops over all remote refs and lists the commits newer than <N> days ago. For each commit its note is read and grep'ed for an existing test name to see whether the build test needs to run again. The `git note show` command that is in this loop nest only takes 14ms to execute, but as it is in a loop, those times add up. ANALYSIS When asked to show a note for a specific commit, git looks up the blob hash for the note and executes `git show` with that hash. That of course adds the child process overhead, but also causes the initialization of a lot of log related configuration, such as for decorations or the mailmap. Simply outputting the blob directly in the main process reduces the run time by almost halve. When looking through the git show implementation for useful stuff that command does that should also be done when showing a note, I could only find the `setup_pager()` call. All other git show functionality was related to showing commits or other non-blob objects. The only thing I was not 100% sure of was the textconv_object stuff. From what I could deduce was that this is only ever used on blobs that represent files in a tree, not on blobs that represent note objects. So I did not include any textconv calls in the git notes code. The first commit is the main one fixing performance. The other three are just eliminating some overhead I noticed when going through the git notes code. Maarten Bosmans (4): notes: print note blob to stdout directly notes: use exisisting function stream_blob_to_fd notes: do not clean up right before calling die() notes: use strbuf_attach to take ownership of the object contents builtin/notes.c | 37 ++++++++++--------------------------- 1 file changed, 10 insertions(+), 27 deletions(-) -- 2.35.3