Add caching for the exec function in rbm
In a mail to tbb-dev, dcf mentioned that while building tor-browser, a lot of time is spent in rbm: https://lists.torproject.org/pipermail/tbb-dev/2020-February/001045.html
I think an easy way to improve this is by caching the result from the exec()
template function. We use it for example with the line version: '[% c("abbrev") %]'
which runs something like exec("git log -1 --format=%h")
, which then runs a git checkout
before running the git log
command. The version
value is used in filenames, and build_id, which are then used in a lot of places, but with no caching we end up doing a lot of calls the same git checkout
and git log
commands. The switch to pion
which added a lot of go projects each with their git repository probably made this issue more visible.