-
Notifications
You must be signed in to change notification settings - Fork 273
RFC: impact of detectHostComponentNames
#1579
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
Comments
It's expected from Jest to recreate the whole environment for each test suite (file). |
You're running the whole RNTL test suite? On my machine it takes about 7s, does it take only 39,4ms on yours? From the tests I'v run on my machine (M3 pro) the difference is less significant, it takes on average 7.45s to run the test suite without the detect and 7.7s Other than that yeah the approach is correct. One thing to note though is that I would expect the difference to be even less significant on a real project where tests per file are likely to be more heavy (I'll try to test it on my current project too). I don't know if the perf impact is high enough to look into alternative approaches, I guess if we find a good one it could be worth |
@pierrezimmermannbam The unit was to be |
Oh I see, that makes sense. Strange that the difference in percentage would be so different on our machines. Also I'm just realizing this shows that calling |
Re %, I've also figured out that is swapped the 13% and 20% (the absolute numbers where correct). Now it should be good in the issue desc. Re |
Closing, re #1697 for v13. |
Summary
I've been curious what is the impact of automatically detecting host component names. Due to the lack of better large test suite I've taken RNTL own tests.
Here is my process:
hostComponentNames
withtest.skip()
.time yarn test
in relevant scenariosconsole.log()
todetectHostComponentNames()
and count execution count (separate run from measuring time).Note: we also have
beforeEach(() => resetToDefaults())
, so I measured it with and without it.detectHostComponentNames
: 39,4 s / 0 runsdetectHostComponentNames
+ withoutbeforeEach(() => resetToDefaults())
: 44,6 s / 63 runs => 13% overheaddetectHostComponentNames
+ withbeforeEach(() => resetToDefaults())
: 47,1 s / 585 runs => 20% overheadSeems like Jet by default clears the runtime state per each file. So we have
detectHostComponentNames()
being called for each file.Here are my questions:
detect...
)The text was updated successfully, but these errors were encountered: