How to determine the best implementation of a Java method

Short answer

  1. Write alternative versions of the method you want to test. They should be named as the original, and suffixed with an index. The rest of the signature must not change.
  2. Download the java-implementation-comparer project from Github.
  3. Build it to add it to your local Maven repository: mvn install
  4. Create a test project importing both:
    • the project you want to test;
    • thejava-implementation-comparer:
  5. Create a test class and write the little code you need:
  6. Just enjoy your comparison:

Something more detailed

Continue reading How to determine the best implementation of a Java method