Skip to content
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

Benchmarks code gen vs reflection #2

Open
WhosNickDoglio opened this issue Mar 18, 2024 · 4 comments
Open

Benchmarks code gen vs reflection #2

WhosNickDoglio opened this issue Mar 18, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@WhosNickDoglio
Copy link
Contributor

I'd be curious about what this affect build times compared to using a reflection based mocking library like mockk vs having the code generated fakes like this

@anthonycr
Copy link
Owner

anthonycr commented Mar 19, 2024

I would like to figure out a good way to actually benchmark this, as in this repo it's basically

:sample:kspTestKotlin + :sample:compileTestKotlin + :sample:test (unscientific average of 3 runs of this is ~2469ms)

vs

:sample:compileTestKotlin + :sample:test (unscientific average 3 runs of this is ~2930ms)

@anthonycr
Copy link
Owner

In theory the savings could be better if :sample:kspTestKotlin and :sample:compileTestKotlin are both cached but the tests still need to run, as the :sample:test run is at least 3x as long (on larger tests i have seen it be more like 5x)

@WhosNickDoglio
Copy link
Contributor Author

Gradle profiler would be good for this. We could profile the test task for projects that use mockingbird vs mockk.

It might also be helpful to write a script to generate a large project (100+ modules) to do a more thorough benchmark. The Tangle docs have that which is nice.

@anthonycr anthonycr added the enhancement New feature or request label Apr 3, 2024
@anthonycr
Copy link
Owner

I ran some preliminary basic benchmarks of clean :sample:test while disabling the tests that expect exceptions and adding in dagger code gen to normalize the difference in compile speed of not having to run ksp if mockingbird isn't enabled. The performance is basically the same. It would be better to do profiling on a larger project like you mentioned though.

mockingbird-benchmark.csv
mockk-benchmark.csv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants