Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce memory allocation in rules and utils #2976

Draft
wants to merge 13 commits into
base: master
Choose a base branch
from

Commits on May 4, 2021

  1. Configuration menu
    Copy the full SHA
    b4cd869 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    152a276 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    35a88cb View commit details
    Browse the repository at this point in the history
  4. Speed up string manipulation and testing

    - Avoid creating new strings by replacing string splits and trims with RegExps
    - Avoid dynamically generating RegExps when possible
    - Compare some arrays by identity first, before checking join('') string identity
    willheslam committed May 4, 2021
    Configuration menu
    Copy the full SHA
    69bcb8d View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    da9231a View commit details
    Browse the repository at this point in the history
  6. Speed up Components utils

    - Avoid allocations where possible (e.g. concating with an empty list)
    - Promote some pure functions to module scope
    - Avoid some wasteful array allocations (filter & length => reduce / some)
    - Move some calculations behind early returns / guards
    willheslam committed May 4, 2021
    Configuration menu
    Copy the full SHA
    8eff94d View commit details
    Browse the repository at this point in the history
  7. Cache lower cased pragma

    willheslam committed May 4, 2021
    Configuration menu
    Copy the full SHA
    671341e View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    0f7183e View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    473d7c1 View commit details
    Browse the repository at this point in the history
  10. Speed up no-deprecated

    - Cache deprecated config
    - Precompute versions instead of re-derive it for each check
    - Avoid reallocating some functions
    - Avoid normalizing already normalized parts
    willheslam committed May 4, 2021
    Configuration menu
    Copy the full SHA
    ccdd17c View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    a2b5327 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    d16fcb3 View commit details
    Browse the repository at this point in the history
  13. Various speed ups by avoiding work and memory allocations

    - Combine filter -> forEach chains
    - Extract deeply nested functions to higher scopes
    - Promote shared or mostly-constant values and conditionals to higher scopes
    - Swap compound boolean expressions to exploit short circuiting
    - Push expensive operations below guards / early returns
    - Push expensive operations into conditionals to exploit short circuiting
    - Swap filters for finds when possible
    - Swap some array function orders, e.g. Filter before reversing arrays
    willheslam committed May 4, 2021
    Configuration menu
    Copy the full SHA
    232d6a1 View commit details
    Browse the repository at this point in the history