Since it seems like more people have joined the "customize git commit hashes because why not" bandwagon (welcome!), I figured I'd share some insights from doing a lot of performance tuning on my own implementation from a few years ago. Obviously, none of this should be taken to discourage new implementations or to ruin any fun.
In decreasing order of effectiveness, the main things that helped were:
- Running on a GPU (this improved performance by roughly a factor of 10, depending on hardware)
- Caching SHA1 buffer state. The tl;dr is that if you put the nonce at the end of your commit message (or signature, if applicable), you can cache the state of the SHA1 algorithm as applied to all but the last ~64 bytes of the commit, and then reapply the cached state to the last 64 bytes on each attempt. This improved performance by a factor of about 4-5 or more, depending on how big the commit is.
- If the nonce is always the same length, then the trailer that the SHA1 puts at the end of data when hashing is also effectively fixed, and I was able to improve the performance of
lucky-commit by about 25% by not recomputing it each time.
(Also mentioning @mkrasnitski from https://github.com/mkrasnitski/git-power-rs)
Since it seems like more people have joined the "customize git commit hashes because why not" bandwagon (welcome!), I figured I'd share some insights from doing a lot of performance tuning on my own implementation from a few years ago. Obviously, none of this should be taken to discourage new implementations or to ruin any fun.
In decreasing order of effectiveness, the main things that helped were:
lucky-commitby about 25% by not recomputing it each time.(Also mentioning @mkrasnitski from https://github.com/mkrasnitski/git-power-rs)