Skip to content
Snippets Groups Projects
Select Git revision
  • main default protected
  • create-k8s-init-objects-dynamically-with-spec-patch
  • ajwalker/fix-depth
  • avonbertoldi/clean-up-ubi-images
  • 16-0-stable
  • update-and-cleanup-git-lfs-install
  • vshushlin/emply-runner-registration-token
  • fneill-move-troubleshooting-to-new-page
  • renovate/golang-1.x
  • renovate/alpine-3.x
  • 31047-don-t-use-docker-links-for-user-defined-networks
  • vshushlin/issue-templates
  • 16-1-stable
  • 16-2-stable
  • fix-job-log-collapsible-sections
  • ajwalker/upgrade-fleeting-latest
  • add-check-interval-metric
  • sh-fix-fips-shell-executor
  • avonbertoldi/29944/revisit-alpine-image-creation-2
  • kballon-main-patch-23985
  • v16.0.3
  • v16.2.1
  • v16.1.1
  • v16.2.0
  • v16.1.0
  • v16.0.2
  • v15.11.1
  • v16.0.1
  • v16.0.0
  • v15.11.0
  • v15.10.1
  • v15.10.0
  • v15.9.1
  • v15.9.0
  • v15.8.3
  • v15.8.2
  • v15.8.1
  • v15.7.4
  • v15.5.2
  • v15.8.0
40 results

shell_escape.go

Forked from GitLab.org / gitlab-runner
10256 commits behind, 8 commits ahead of the upstream repository.
  • Nick Thomas's avatar
    8ea124b6
    Add a benchmark for helpers.ShellEscape and optimise it · 8ea124b6
    Nick Thomas authored
    The improvement is 4 (430 to 0.02 seconds) orders of magnitude, and
    particularly affects large files specified with the `tls-ca-file` configuration
    variable.
    
    The problem was successive string allocations - the for { out += oneChar }
    pattern is death to any garbage collector, and there are several allocations
    per byte as well(!)
    
    Switching to a `bytes.Buffer` for output (conservatively set to 2x the size of
    the input string) and avoiding most addtional allocations and calls to
    `fmt.Sprintf` is super-helpful.
    8ea124b6
    History
    Add a benchmark for helpers.ShellEscape and optimise it
    Nick Thomas authored
    The improvement is 4 (430 to 0.02 seconds) orders of magnitude, and
    particularly affects large files specified with the `tls-ca-file` configuration
    variable.
    
    The problem was successive string allocations - the for { out += oneChar }
    pattern is death to any garbage collector, and there are several allocations
    per byte as well(!)
    
    Switching to a `bytes.Buffer` for output (conservatively set to 2x the size of
    the input string) and avoiding most addtional allocations and calls to
    `fmt.Sprintf` is super-helpful.
shell_escape.go 2.61 KiB