Commit Graph

9 Commits

Author SHA1 Message Date
Miloslav Trmač 3220ac45c6 Reformat import sections
golangci-lint linter: gci

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2023-02-06 21:22:47 +01:00
Daniel J Walsh 27cfaea55d
Do not preallocate regex in init program
We are trying to speed up startup time of apps based on
containers/image regex takes some time on every start
when in init. Moving this to a sync.Once should not
effect any change on the system.

Only changing internal regexp, since changing external would be a
breaking change to the library.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-01-13 16:49:57 -05:00
Daniel J Walsh b30947b041
Drop dead code that causes a regex compilation on init
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-01-13 16:21:42 -05:00
Valentin Rothberg dec5bbae43 docker/reference.expression: use strings.Join()
To drop the unbelievable amount of 2 allocs on init().

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-11-30 10:47:50 +01:00
Valentin Rothberg e2cf031b80 docker/reference.literal: return QuoteMeta directly
Drop allocs from 4501 to 4413.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-11-30 10:45:59 +01:00
Valentin Rothberg 54d770f850 docker/reference/regexp.go: constify strings
Reduces some heat on init.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-11-29 11:23:51 +01:00
Valentin Rothberg 532f59ebfa docker/reference: reduce regex compilations
Improve the code such that a given raw regex string is compiled only
once.

Before:
init 1341880 bytes, 11453 allocs

After:
init 485600 bytes, 4501 allocs

Copied-from: distribution/distribution/pull/3566
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-11-29 11:23:51 +01:00
Miloslav Trmač 6ddbf03773 Update docker/reference from docker/distribution/reference
Primarily to make DomainRegexp public.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2019-05-29 00:30:55 +02:00
Miloslav Trmač ecdd233c84 Copy github.com/docker/distribution/reference to docker/reference
This replaces the copy of github.com/docker/docker/reference in the same
place, which we have just gotten rid of, and allows using this package
even in consumers which insist on an incompatible version of
docker/distribution.

The copy has been edited to drop a reference to
github.com/docker/distribution/digestset .

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2017-02-07 15:25:27 +01:00