Skip to content

small performance optimizations for running hooks#5893

Merged
thaJeztah merged 2 commits intodocker:masterfrom
thaJeztah:hooks_optim
Mar 5, 2025
Merged

small performance optimizations for running hooks#5893
thaJeztah merged 2 commits intodocker:masterfrom
thaJeztah:hooks_optim

Conversation

@thaJeztah
Copy link
Copy Markdown
Member

cmd/docker: small performance optimizations for running hooks

Order conditions to check for lightweight ones first;

  • checck if the command is not nil
  • dockerCli.Out().IsTerminal() is a lightweight getter
  • dockerCli.HooksEnabled() checks for env-vars, parses booleans, and
    reading the CLI config-file

cli/command: DockerCli.HooksEnabled check current before legacy

The DOCKER_CLI_HINTS env-var is replaced by DOCKER_CLI_HOOKS; check the
new env-var first, and only fall back to checking the legacy env-var
if it's not set.

- Human readable description for the release notes

- A picture of a cute animal (not mandatory but encouraged)

Order conditions to check for lightweight ones first;

- checck if the command is not nil
- dockerCli.Out().IsTerminal() is a lightweight getter
- dockerCli.HooksEnabled() checks for env-vars, parses booleans, and
  reading the CLI config-file

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
The DOCKER_CLI_HINTS env-var is replaced by DOCKER_CLI_HOOKS; check the
new env-var first, and only fall back to checking the legacy env-var
if it's not set.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah thaJeztah added status/2-code-review kind/refactor PR's that refactor, or clean-up code labels Mar 5, 2025
@thaJeztah thaJeztah added this to the 28.0.2 milestone Mar 5, 2025
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 5, 2025

Codecov Report

Attention: Patch coverage is 60.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 59.29%. Comparing base (ea1f10b) to head (6d551e0).
Report is 5 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #5893   +/-   ##
=======================================
  Coverage   59.29%   59.29%           
=======================================
  Files         355      355           
  Lines       29753    29753           
=======================================
  Hits        17641    17641           
  Misses      11140    11140           
  Partials      972      972           

@thaJeztah thaJeztah merged commit a9e5309 into docker:master Mar 5, 2025
@thaJeztah thaJeztah deleted the hooks_optim branch March 5, 2025 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/refactor PR's that refactor, or clean-up code status/2-code-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants