Add benchmark to test compiler performance#16083
Add benchmark to test compiler performance#16083adityapatwardhan merged 8 commits intoPowerShell:masterfrom
Conversation
|
Instead of compiling the
|
|
I don't see value from one large synthetic perf test (exclusion is startup scenario). |
My last change made exact that possible. All you need is to add or replace a function in the I'd love to have functions that target specific constructs that we are especially interested in, but I also think having some large-size real-world scripts to track the compilation perf as a whole is helpful. I'm sure there are better testing script than some of the functions I kept in |
| throw "Failed to create $createdPackage" | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Using our build and packaging code as a test case 🤣
There was a problem hiding this comment.
Yeah, I simply chose some big-size functions from build.psm1 and packaging.psm1.
Not sure if that's a good idea though, because the scripting pattern of those functions are more or less the same -- a lot of if statements, a lot switch statements, and a lot command invocations.
There was a problem hiding this comment.
I think it is good real life scenario.
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| #if NET6_0 |
There was a problem hiding this comment.
Why just NET6, it would be good if we can compile and run against NET to compare perf between 7.1 and 7.2 right?
There was a problem hiding this comment.
The test uses the internal API directly. 7.1 and 7.2 doesn't have the internal visible attribute defined for powershell-perf.dll
|
🎉 Handy links: |
PR Summary
Add benchmark to test compiler performance.
The benchmark uses the
compiler.test.ps1file in our repo, and try compiling it for every call ofCompileFunction.Instead of compile the
compiler.test.ps1as a whole, the benchmark extracts all top-level functions from the file and compile those functions individually. This is because:PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.