The revision traversal limited by pathspec has optimization when the pathspec has only one element, it does not use any pathspec magic (other than literal), and there is no wildcard. The absence of optimization for multiple pathspec elements in revision traversal cause an issue raised by Kai Koponen at https://lore.kernel.org/git/CADYQcGqaMC=4jgbmnF9Q11oC11jfrqyvH8EuiRRHytpMXd4wYA@xxxxxxxxxxxxxx/ While it is much harder to lift the latter two limitations, supporting a pathspec with multiple elements is relatively easy. Just make sure we hash each of them separately and ask the bloom filter about them, and if we see none of them can possibly be affected by the commit, we can skip without tree comparison. First commit creates a new data structure `struct bloom_keyvec` to hold all bloom keys for a single pathspec item. Second commit add for loop to check if any pathspec item's keyvec is contained in a commit's bloom filter. With this change, testing on Kai's example shows that git rev-list -10 3730814f2f2bf24550920c39a16841583de2dac1 -- src/clean.bash src/Make.dist runs as fast as git rev-list -10 3730814f2f2bf24550920c39a16841583de2dac1 -- src/Make.dist && \ git rev-list -10 3730814f2f2bf24550920c39a16841583de2dac1 -- src/clean.bash Lidong Yan (2): bloom: replace struct bloom_key * with struct bloom_keyvec bloom: optimize multiple pathspec items in revision traversal bloom.c | 31 +++++++++++ bloom.h | 20 +++++++ revision.c | 121 ++++++++++++++++++++++++------------------- revision.h | 6 +-- t/t4216-log-bloom.sh | 10 ++-- 5 files changed, 127 insertions(+), 61 deletions(-) -- 2.50.0.108.g6ae0c543ae