mockery: Docker Performance Slow Compared to Brew Installation
Description
I’m trying to understand more about why running mockery seems to be so much slower than when run bare metal.
I read through the issue todo and cleaned out my go mod cache.
Mockery Version
v2.46.1
Go Version
go version go1.23.1 darwin/arm64
Installation Method
- Binary Distribution
- Docker
- brew
- go install
- Other: [specify]
Steps to Reproduce
You can repro this in the neosync repo.
go clean -modcachego mod downloadmockery~ 3 secondsdocker run -v "$PWD":/src -w /src vektra/mockery:v2.46.1~1 minute
I’ve even tried mounting only what is necessary via:
docker run \
-v "$PWD/backend":/src/backend \
-v "$PWD/worker":/src/worker \
-v "$PWD/internal":/src/internal \
-v "$PWD/.mockery.yml":/src/.mockery.yml \
-v "$PWD/go.mod":/src/go.mod \
-v "$PWD/go.sum":/src/go.sum \
-v "${GOPATH:-$HOME/go}/pkg/mod":/go/pkg/mod \
-w /src \
vektra/mockery:v2.46.01
But the docker run still takes orders of magnitude longer than the bare metal.
Am I missing some form of cache that should be mounted into the docker container?
Expected Behavior
The docker run should be near the speed of the brew installed version.
Actual Behavior
Takes much longer.
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 19 (9 by maintainers)
Yes I also believe this is not the case, I run
go mod downloadbefore running mockery. Something is happening only in mockery for it to be so slow in docker, the performance difference is too big compared to other things (like even the Go compiler).I don’t believe that is the case. If you see in my original example I am mounting my go mod directory, so there shouldn’t need to be any difference there.
I run a variety of tools inside of docker and the performance is negligible. The only one that I’ve seen a slowdown on is mockery.