Skip to content

Commit

Permalink
Fixes #3607 - Remove bad test for CharOperationTest performance
Browse files Browse the repository at this point in the history
Signed-off-by: Rob Stryker <[email protected]>
  • Loading branch information
Rob Stryker authored and rgrunber committed Feb 10, 2025
1 parent e498a7a commit 64f02c5
Showing 1 changed file with 0 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -170,26 +170,4 @@ public void test012() {
4,
true));
}

public void testReplacePerformance001() {
// This is the test that takes an excessively long time
// The improvement here is drastic, 99% reduction in time
testReplaceImpl("This is one line with no matches\n", 9, 0.01);
}

private void testReplaceImpl(String oneLine, int power, double multiplier) {
String total = oneLine;
for( int i = 0; i < power; i++ ) {
total = total + total; // Double the length
}
total = oneLine + total;

// Now replace
long start = System.currentTimeMillis();
char[] found = CharOperation.replace(total.toCharArray(), new char[]{'/'}, new char[] {'z'});
assertNotNull(found);
long end = System.currentTimeMillis();
long spent = end - start;
assertTrue(spent < 10);
}
}

0 comments on commit 64f02c5

Please sign in to comment.