Skip to content

Commit

Permalink
fix: slow CLI start-up time
Browse files Browse the repository at this point in the history
Found a deeply nested dependency which was importing `https://github.com/markbates/pkger`, causing unreasonable CPU consumption and significant delay at start up time. With this patch, start up time was reduced from almost 3s to ~0.01s.

```
$ time kratos
kratos  2.55s user 2.46s system 508% cpu 0.986 total

$ time ./kratos-patch
./kratos-patch  0.00s user 0.00s system 64% cpu 0.001 total
```
  • Loading branch information
aeneasr committed Oct 24, 2021
1 parent 7a1be57 commit ae20c17
Show file tree
Hide file tree
Showing 2 changed files with 286 additions and 123 deletions.
47 changes: 16 additions & 31 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ replace (
)

require (
github.com/DataDog/datadog-go v4.7.0+incompatible // indirect
github.com/HdrHistogram/hdrhistogram-go v1.1.0 // indirect
github.com/Masterminds/semver v1.5.0 // indirect
github.com/Masterminds/sprig/v3 v3.0.0
github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0
Expand All @@ -29,27 +27,24 @@ require (
github.com/bwmarrin/discordgo v0.23.0
github.com/bxcodec/faker/v3 v3.3.1
github.com/cenkalti/backoff v2.2.1+incompatible
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/containerd/containerd v1.5.2 // indirect
github.com/coreos/go-oidc v2.2.1+incompatible
github.com/cortesi/modd v0.0.0-20210323234521-b35eddab86cc
github.com/davecgh/go-spew v1.1.1
github.com/davidrjonas/semver-cli v0.0.0-20190116233701-ee19a9a0dda6
github.com/duo-labs/webauthn v0.0.0-20210727191636-9f1b88ef44cc
github.com/fatih/color v1.10.0
github.com/fatih/color v1.13.0
github.com/form3tech-oss/jwt-go v3.2.2+incompatible
github.com/ghodss/yaml v1.0.0
github.com/go-errors/errors v1.0.1
github.com/go-openapi/strfmt v0.20.0
github.com/go-openapi/strfmt v0.20.3
github.com/go-playground/validator/v10 v10.4.1
github.com/go-swagger/go-swagger v0.26.1
github.com/gobuffalo/fizz v1.13.1-0.20201104174146-3416f0e6618f
github.com/gobuffalo/httptest v1.0.2
github.com/gobuffalo/pop/v5 v5.3.3
github.com/gofrs/uuid v3.2.0+incompatible
github.com/gobuffalo/pop/v5 v5.3.4
github.com/gofrs/uuid v4.1.0+incompatible
github.com/golang-jwt/jwt/v4 v4.1.0
github.com/golang/gddo v0.0.0-20190904175337-72a348e765d2
github.com/golang/glog v1.0.0 // indirect
github.com/golang/mock v1.6.0
github.com/google/go-github/v27 v27.0.1
github.com/google/go-github/v38 v38.1.0
Expand All @@ -58,23 +53,21 @@ require (
github.com/gorilla/sessions v1.2.1
github.com/gtank/cryptopasta v0.0.0-20170601214702-1f550f6f2f69
github.com/hashicorp/consul/api v1.5.0
github.com/hashicorp/go-retryablehttp v0.6.8
github.com/hashicorp/go-retryablehttp v0.7.0
github.com/hashicorp/golang-lru v0.5.4
github.com/imdario/mergo v0.3.12
github.com/inhies/go-bytesize v0.0.0-20201103132853-d0aed0d254f8
github.com/jandelgado/gcov2lcov v1.0.5 // indirect
github.com/inhies/go-bytesize v0.0.0-20210819104631-275770b98743
github.com/jteeuwen/go-bindata v3.0.7+incompatible
github.com/julienschmidt/httprouter v1.3.0
github.com/knadh/koanf v1.2.2
github.com/knadh/koanf v1.3.0
github.com/luna-duclos/instrumentedsql v1.1.3
github.com/luna-duclos/instrumentedsql/opentracing v0.0.0-20201103091713-40d03108b6f4
github.com/mattn/goveralls v0.0.7
github.com/mikefarah/yq v1.15.0
github.com/mitchellh/mapstructure v1.4.2 // indirect
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe
github.com/ory/analytics-go/v4 v4.0.0
github.com/ory/dockertest/v3 v3.6.5
github.com/ory/analytics-go/v4 v4.0.2
github.com/ory/dockertest/v3 v3.8.0
github.com/ory/go-acc v0.2.6
github.com/ory/go-convenience v0.1.0
github.com/ory/graceful v0.1.1
Expand All @@ -83,30 +76,22 @@ require (
github.com/ory/kratos-client-go v0.6.3-alpha.1
github.com/ory/mail/v3 v3.0.0
github.com/ory/nosurf v1.2.5
github.com/ory/x v0.0.292
github.com/pelletier/go-toml v1.9.4 // indirect
github.com/ory/x v0.0.300
github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2
github.com/philhofer/fwd v1.1.1 // indirect
github.com/pkg/errors v0.9.1
github.com/pquerna/otp v1.3.0
github.com/rs/cors v1.6.0
github.com/rs/cors v1.8.0
github.com/sirupsen/logrus v1.8.1
github.com/slack-go/slack v0.7.4
github.com/spf13/cast v1.4.1 // indirect
github.com/spf13/cobra v1.2.1
github.com/spf13/pflag v1.0.5
github.com/sqs/goreturns v0.0.0-20181028201513-538ac6014518
github.com/stretchr/testify v1.7.0
github.com/tidwall/gjson v1.7.1
github.com/tidwall/sjson v1.1.5
github.com/uber/jaeger-lib v2.4.1+incompatible // indirect
github.com/tidwall/gjson v1.9.4
github.com/tidwall/sjson v1.2.2
github.com/urfave/negroni v1.0.0
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97
golang.org/x/mod v0.5.1 // indirect
golang.org/x/oauth2 v0.0.0-20210402161424-2e8d93401602
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/tools v0.1.6
gopkg.in/ini.v1 v1.63.2 // indirect
golang.org/x/tools v0.1.7
)

0 comments on commit ae20c17

Please sign in to comment.