Avoid loading compose info unless needed#1001
Avoid loading compose info unless needed#1001henrinormak wants to merge 1 commit intotestcontainers:mainfrom
Conversation
✅ Deploy Preview for testcontainers-node ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
|
What I don't know is how breaking the lack of compose info on the container runtime client is, i.e that's an exposed API from testcontainers that someone could theoretically be depending on. |
|
@cristianrgreco any feedback on this? I know that it's a bit out of the left-field (unexpected PR or something), but I've been going after any low-hanging fruit in our CI pipelines to optimize testing and this seemed like a good candidate. |
|
Hey @henrinormak, apologies for the delay. I've seen the PR but not sure what to do with it yet 😄 I agree the time save is worth it, I just don't like introducing the |
|
Superseded by #1012 |
|
Thanks! I think that makes sense and my main goal was to just remove the time spent on compose if compose is not used. |
This improves performance in scenarios where the caller does not rely or need compose in any way.
Anecdotal evidence is from a repository that has 289 test cases, ~260 of which somehow interact with testcontainers. There's enough abstraction between the tests and testcontainers so that not each of the tests hits this slow path, but still, the timing (run on a M3 Pro) shows a clear improvement.
Before - 19.69s, 18.30s, 18.05s, 17.54s, 17.70s - average 18.256s
After - 18.03s, 15.61s, 15.57s, 16.46s, 15.54s - average 16.242s
It's not much, but in all likelihood, depending on the setup, the difference is bigger with more parallel test suites, or situations in which
getContainerRuntimeClientis called from different workers/processes more.