junit-team / junit4

A programmer-oriented testing framework for Java.
https://junit.org/junit4
Eclipse Public License 1.0
8.53k stars 3.28k forks source link

Perfromance improvements junit 4.7 #17

Closed krosenvold closed 15 years ago

krosenvold commented 15 years ago

Running with a profiler revealed that 70-80% of the execution time of junit 4.7 is spent with the "getDescription" hierarchy. The patch basically does 2 things: A) Replaces the use of String.format with stringbuilder B) Caches descriptions in the ParentRunner

Change B actually modifies the API between parent-runners and their subclasses slightly, which may/may not be a good idea. (I see alternate ways of doing this that do not have this direct side effect)

There is no specific test for this improvement, since it is covered by other tests. Please be warned that the branch "speedImprovement" at git@github.com:krosenvold/junit.git also contains the two concurrency patches I have submitted.

krosenvold commented 15 years ago

After getting some more experience with this patch I feel quite certain that the suggested solution to B should not be used, because it changes the contract between the ParentRunner and its children too much - without sufficient value. The (minor) patch to the Description class still has a large effect

krosenvold commented 15 years ago

I reworked patch B, which can now be found at branch perftune2 instead, repo git://github.com/krosenvold/junit.git