Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

IterableAssert.doesNotHaveDuplicates became unsable with many elements #122

Open
thomas-hilaire opened this Issue Nov 6, 2012 · 1 comment

Comments

Projects
None yet
2 participants

Hello,

I used fest in my projects at a snapshot version :
44bf124 FEST-258 : fix NPE that would occur if error stack trace filtering is enabled and we JUnit is not in the classpath

I encountered a performance issue with Fest 2.0M8 in *IterableAssert.doesNotHaveDuplicates method.
I made a small bench using a simple unit test to compare these versions :

Test :

@Test
public void testManyGeneration() {
    Stopwatch stopwatch = new Stopwatch().start();
    int generationCount = 10000;

    List<String> generated = Lists.newArrayListWithExpectedSize(generationCount);
    for (int count = 0; count < generationCount; count++) {
        generated.add(UUID.randomUUID().toString());
    }

    assertThat(generated).doesNotHaveDuplicates();
    System.out.println("Time elapsed in ms : " + stopwatch.stop().elapsedMillis());
}

Result :

version 2.0M8 :
10000 entries => Time elapsed in ms : 1907
100000 entries => Time elapsed in ms : 418619

version 44bf124 :
10000 entries => Time elapsed in ms : 198
100000 entries => Time elapsed in ms : 629

Can you improve the new version of doesNotHaveDuplicates method ?

Thanks for your library which is part of our DSL now, so appreciated !
Thomas

Contributor

joel-costigliola commented May 12, 2013

Hi,
Just to let you know that this issue has been solved in AssertJ core in 1.2.0 release (AssertJ is a fork of Fest Assert). It is not yet solved in Fest (the previous github automatic comment may be confusing).

Regards,

Joel Costigliola

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment