[Blog] 5x speedup changing break to elemIndex!
Haskell Community [Unofficial]
April 19, 2026
Very cool! This is a nice general optimization.
In your specific case, I think there is a much easier solution though. git grep has already parsed the exact match you’re looking for and you only need to re-parse every line because your git grep returns the entire line.
If you tell it to return only the exact matches (with git grep -o and a pattern that includes the contents of the references like with -E: (@|#)\(ref:[^)]*\), then you will get one result per match (instead of one per line) and only need to trimm off the first and last character
Discussion in the ATmosphere