-
Notifications
You must be signed in to change notification settings - Fork 823
Tests: Reduce memory use in ComponentTests #18527
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
Conversation
✅ No release notes required |
ed58946
to
00f53bc
Compare
cbb0d0c
to
71d5f5b
Compare
Underlying issue is possibly #15669. |
😮💨 this is ready. |
You are a Legend Sir. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for getting to the bottom of it, this memory hungriness was introduced by me.
I did when migrating "fat" tests which did full fsc.exe compilation and then ran a dotnet program.
Using a shared FSI session for tests that care about execution results saved sometimes 500ms per test just by avoiding the file IO and process overhead - at the cost of keeping stuff in that shared session and increasing memory.
Manually choosing between shared and isolated sounds good.
If we really want to dogfood and automate this "shared vs isolated" decision, we could consider using the new caching+eviction mechanisms to balance amortized startup time overhead vs. memory :)) (in practise it would be hard to predict upfront which tests will consume a lot, the level of variation between test file sizes is quite high)
Yes, getting the tests in-proc (and in memory as opposed to on disk) is generally good. This here is just a workaround and the actual issues are
|
One suspect could be loading of all the necessary implicit framework imports and their related objects (Types, Methods,..) |
ComponentTests allocate a lot, and the Linux CI instance can barely take it:

A lot of fsi sessions are created to run script tests, that's one reason.
We can cache and reuse them, on practical basis, i.e. it's not always possible and some tests must be excluded from it, but most are fine. To exclude any test that is not cooperating, just run it with
singleTestBuildAndRunIsolated
.I also added metrics telemetry export in tests. OTEL export is now generally enabled by setting
FSHARP_OTEL_EXPORT
env var.Before, after:

I need this to unblock #18499.