Master faster visit matching ranges lul#8911
Open
LucasLefevre wants to merge 2 commits into
Open
Conversation
Improve all functions using visitMatchingRanges: COUNTIF(S), SUMIF(S), COUNTUNIQUEIFS, AVERAGEIF(S), MAXIF(S), MINIF(S) The common case isn't wildcard comparisons. Yet, a regexp check is not cheap. With this commit, we optimize the common case which doesn't use wildcard by skipping regexp matching. Bunch tool ---------- cells imported in 6ed4851: Mean: 2684.08 ms, StdErr: 15.90 ms 9ab3d8ef2: Mean: 2689.98 ms, StdErr: 27.34 ms → ⚫ (vs prev: +0%, Δ=+5.90 ms, combined StdErr=31.63 ms, |Δ|/SE=0.2x; n=20) evaluate all cells 6ed4851: Mean: 2460.76 ms, StdErr: 31.45 ms 9ab3d8ef2: Mean: 2054.28 ms, StdErr: 17.58 ms → 🟢 (vs prev: -17%, Δ=-406.47 ms, combined StdErr=36.02 ms, |Δ|/SE=-11.3x; n=20) START 6ed4851: Mean: 3175.20 ms, StdErr: 40.12 ms 9ab3d8ef2: Mean: 2767.07 ms, StdErr: 22.78 ms → 🟢 (vs prev: -13%, Δ=-408.13 ms, combined StdErr=46.13 ms, |Δ|/SE=-8.8x; n=20) Model created in 6ed4851: Mean: 6017.55 ms, StdErr: 55.30 ms 9ab3d8ef2: Mean: 5617.84 ms, StdErr: 49.23 ms → 🟢 (vs prev: -7%, Δ=-399.71 ms, combined StdErr=74.04 ms, |Δ|/SE=-5.4x; n=20) Global 6ed4851: Mean: 6017.84 ms, StdErr: 55.30 ms 9ab3d8ef2: Mean: 5618.14 ms, StdErr: 49.23 ms → 🟢 (vs prev: -7%, Δ=-399.70 ms, combined StdErr=74.04 ms, |Δ|/SE=-5.4x; n=20) Legend: ⚫: no measurable change |Δ|/SE < 2 🔴: slower Δ > 0 and |Δ|/SE >= 2 🟢: faster Δ < 0 and |Δ|/SE >= 2
The operand is processed over and over again when evaluating the predicate for each element of the range, which could be huge. With this commit, we "pre-compile" the predicate once into a closure, then use the closure for each element. cells imported in 097548002: Mean: 2644.16 ms, StdErr: 12.60 ms 5ccb69f49: Mean: 2646.22 ms, StdErr: 8.92 ms → ⚫ (vs prev: +0%, Δ=+2.06 ms, combined StdErr=15.44 ms, |Δ|/SE=0.1x; n=4) evaluate all cells 097548002: Mean: 2014.48 ms, StdErr: 7.52 ms 5ccb69f49: Mean: 1910.35 ms, StdErr: 16.59 ms → 🟢 (vs prev: -5%, Δ=-104.13 ms, combined StdErr=18.22 ms, |Δ|/SE=-5.7x; n=4) START 097548002: Mean: 2699.31 ms, StdErr: 8.32 ms 5ccb69f49: Mean: 2602.79 ms, StdErr: 17.18 ms → 🟢 (vs prev: -4%, Δ=-96.51 ms, combined StdErr=19.09 ms, |Δ|/SE=-5.1x; n=4) Model created in 097548002: Mean: 5500.24 ms, StdErr: 12.36 ms 5ccb69f49: Mean: 5401.26 ms, StdErr: 20.85 ms → 🟢 (vs prev: -2%, Δ=-98.99 ms, combined StdErr=24.24 ms, |Δ|/SE=-4.1x; n=4) Global 097548002: Mean: 5500.54 ms, StdErr: 12.36 ms 5ccb69f49: Mean: 5401.55 ms, StdErr: 20.85 ms → 🟢 (vs prev: -2%, Δ=-98.99 ms, combined StdErr=24.24 ms, |Δ|/SE=-4.1x; n=4) Legend: ⚫: no measurable change |Δ|/SE < 2 🔴: slower Δ > 0 and |Δ|/SE >= 2 🟢: faster Δ < 0 and |Δ|/SE >= 2
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description:
Bunch tool
Task: TASK_ID
review checklist