Pprof compare between two implementation of same function

I have a function calc to optimize. Say the old version as base and the new version as opt. There are 3 ways I can figure out to compare the performance in function/instruction level of pprof.

  1. use //go:build opt and go test -tags=tagA -bench BenchmarkXXX -run none -cpuprofile -o opt.out for opt and //go:build !opt and go test -bench BenchmarkXXX -run none -cpuprofile -o base.out for base. Then use go tool pprof -base base.out opt.out to compare these two versions. But since code are built with different tags and the function definitions of calc are in two files, pprof can’t actually compare calc as follows:

  1. use git history. One commit for base and one commit for opt, calc is implemented in one file. But git reset might not be convenient I think?
  2. use two copy of repositories, one for base and one for opt. But file paths of base and opt are different. As approach 1, pprof won’t compare these two versions of calc in different files.

Are there some other ways to compare the two different versions of calc?