Performance

49 views
Skip to first unread message

Ray

unread,
Feb 12, 2021, 6:14:49 PM2/12/21
to mockito
Hi,
In some (proprietary) projects I am involved in, Mockito seems to be the primary reason why our unit tests are slow.
Are there any tools to show which mocks take a long time to create, or tips on how to make Mockito faster?
Thanks for any tips or information anyone can provide.
-Ray

Tim van der Lippe

unread,
Feb 12, 2021, 6:15:30 PM2/12/21
to mockito
Please join the discussion at https://github.com/mockito/mockito/issues/2178

Op vr 12 feb. 2021 om 23:14 schreef Ray <disp...@gmail.com>:
--
You received this message because you are subscribed to the Google Groups "mockito" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mockito+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mockito/a547f664-a036-4493-803b-9be563a7c54fn%40googlegroups.com.

Michael Pinnegar

unread,
Feb 12, 2021, 6:17:28 PM2/12/21
to moc...@googlegroups.com
I'd you're curious about where your time is going you'd get a lot of easy bang for your buck with a simple test creating your mocks and seeing how much time they take to make.

My guess is mockito uses a lot of reflect under the hood which is inheritly slow.

--

Ray

unread,
Feb 13, 2021, 2:59:47 AM2/13/21
to mockito
Thanks, will follow the Github issue.
I need to do some profiling to get a better sense of where the time is going, and I've only looked at a couple classes, but so far it looks like Mockito slows things down by 50-75% compared to manually creating test stubs.
Reply all
Reply to author
Forward
0 new messages