[go: up one dir, main page]

Skip to content

Add performance improvements to git-last-modified(1)

The subcommand git-last-modified(1) was based on the patches shared by Taylor and the folks at GitHub1. That version used an alternative implementation to make it "go faster". When I was working on upstreaming those patches, I dropped the patches2 for this implementation, because I didn't see significant improvements.

This series revives those changes. I did more thorough deep dive through the code and the algorithm and got the code working a lot faster. The benchmark results can be found in the commit message.

Some changes compared to GitHub's version include:

  • Use of struct bitmap from "ewah/ewok.h", instead of self-defined struct commit_active_paths.

  • Removed shortcut code that handled the case when commit and parent are fully treesame, and instead always checked 'active_c' whether the next parent is worth looking at.

  • Modified comments and commit message to make the algorithm more clear (at least to me).

  • Mentioned the use of PARENT1 and PARENT2 in object.h.

  • Removed the use of any global variables.

  • Less conditions are checked in mark_path() because the hashmap of 'paths' is considered the single-source of truth.

  • pass_to_parent() doesn't pass on when the path isn't in the 'paths' hashmap no more.

Cc: Karthik Nayak karthik.188@gmail.com Cc: Justin Tobler jltobler@gmail.com Cc: Taylor Blau me@ttaylorr.com Signed-off-by: Toon Claes toon@iotcl.com


Changes in v2:

--- b4-submit-tracking ---

This section is used internally by b4 prep for tracking purposes.

{ "series": { "revision": 2, "change-id": "20251009-b4-toon-last-modified-faster-4c8956a95261", "prefixes": [], "history": { "v1": [ "20251016-b4-toon-last-modified-faster-v1-1-85dca8a29e5c@iotcl.com" ] } } }

Edited by Toon Claes

Merge request reports

Loading