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

Various minor improvements to speed up by ~10% #8193

Merged
merged 5 commits into from Jun 28, 2022

Commits on Jun 28, 2022

  1. split loop for better performance

    * check isset for all elements first, as array_diff is much more expensive
    * Improves performance by 1%
    kkmuffme committed Jun 28, 2022
    Copy the full SHA
    4db928e View commit details
    Browse the repository at this point in the history
  2. only sort when necessary and faster hash

    * sort is much more expensive than count, so we only sort if we have something to sort
    * could implement for ksort too, but advantage there is minimal since we almost always have more than 1 possibility
    * use same hash algorithm as in other places (= faster)
    * reduces runtime by 2-3%
    kkmuffme committed Jun 28, 2022
    Copy the full SHA
    4048bb9 View commit details
    Browse the repository at this point in the history
  3. assign keys to variable for better performance

    improves performance by ~1-1.5%
    kkmuffme committed Jun 28, 2022
    Copy the full SHA
    57239a7 View commit details
    Browse the repository at this point in the history
  4. improve cache hash performance

    * do not concatenate with timestamp as this is slow, since $file_contents may be big
    * use file contents not file path for cache hash only to ensure it works if file_path not set but file_content is
    * improves performance by ~5%
    kkmuffme committed Jun 28, 2022
    Copy the full SHA
    9082eab View commit details
    Browse the repository at this point in the history
  5. check if file in cache already before adding

    * reduces I/O by 30%
    * minimal performance improvement (<0.5%)
    kkmuffme committed Jun 28, 2022
    Copy the full SHA
    9058608 View commit details
    Browse the repository at this point in the history