Last active
March 16, 2026 04:13
-
-
Save Medohh2120/f565516bc636700adf5ba27fd8f0d19e to your computer and use it in GitHub Desktop.
BENCHMARK — Excel LAMBDA Performance Timer
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
| /* | |
| Name: BENCHMARK | |
| Description: Runs a formula N iterations and returns avg & total execution time. | |
| Func must be wrapped in LAMBDA() =BENCHMARK(LAMBDA(your_formula), 50) | |
| [iterations] default: 1 | |
| [time_unit] default: 0 (ms), 1 = seconds | |
| Because this function uses NOW(), manual calculation mode is highly recommended. | |
| Made By: Medohh2120 | |
| */ | |
| BENCHMARK = LAMBDA(Func, [iterations], [time_unit], | |
| LET( | |
| iterations, IF(ISOMITTED(iterations), 1, iterations), | |
| start_time, NOW(), | |
| loop_result, REDUCE(0, SEQUENCE(iterations), LAMBDA(acc, i,Func())), | |
| total_ms, (NOW() - start_time) * 86400000, | |
| avg, total_ms / iterations, | |
| IF(time_unit, | |
| "avg: " & TEXT(avg / 1000, "0.000") & "s | total: " & TEXT(total_ms / 1000, "0.000") & "s", | |
| "avg: " & TEXT(avg, "0.00") & "ms | total: " & TEXT(total_ms, "0") & "ms" | |
| ) | |
| ) | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment