Skip to content

Optimize common anti patterns #161

@marshall-mcmullen

Description

@marshall-mcmullen
┌──────────────────────────────────────────────────┬─────────────┬───────────────────┐
  │                     Pattern                      │ Occurrences │      Impact       │
  ├──────────────────────────────────────────────────┼─────────────┼───────────────────┤
  │ for item in $(command) (subshell in loop)        │ 20+         │ O(n) subshells    │
  ├──────────────────────────────────────────────────┼─────────────┼───────────────────┤
  │ External commands in hot paths (tput, which, ps) │ 50+         │ 10-50ms each fork │
  ├──────────────────────────────────────────────────┼─────────────┼───────────────────┤
  │ eval "echo \${${var}...}"                        │ 30+         │ Double subshell   │
  └──────────────────────────────────────────────────┴─────────────┴───────────────────┘

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions