fix 优化排序benchmark

This commit is contained in:
mochouZero555 2024-07-25 09:18:35 +08:00
parent b330e57671
commit 3bc4743ac3

View File

@ -2,9 +2,11 @@ package cn.hutool.core.comparator;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.StopWatch; import cn.hutool.core.date.StopWatch;
import cn.hutool.core.lang.Console;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import java.util.Arrays; import java.util.Arrays;
@ -41,7 +43,8 @@ public class IndexedComparatorTest {
} }
@Test @Test
public void benchMarkSortTest() { @Ignore
public void benchmarkSortTest() {
final Object[] arr ={"a", "b", new User("9", null), "1",3,null,"2"}; final Object[] arr ={"a", "b", new User("9", null), "1",3,null,"2"};
final Collection<Object> set = new HashSet<>(Arrays.asList(arr)); final Collection<Object> set = new HashSet<>(Arrays.asList(arr));
@ -52,7 +55,6 @@ public class IndexedComparatorTest {
final List<Object> sortSet = CollectionUtil.sort(set, new IndexedComparator<>(arr)); final List<Object> sortSet = CollectionUtil.sort(set, new IndexedComparator<>(arr));
} }
stopWatch.stop(); stopWatch.stop();
System.out.println(stopWatch.prettyPrint());
stopWatch.start(); stopWatch.start();
@ -60,7 +62,7 @@ public class IndexedComparatorTest {
final List<Object> sortSet = CollectionUtil.sort(set, new ArrayIndexedComparator<>(arr)); final List<Object> sortSet = CollectionUtil.sort(set, new ArrayIndexedComparator<>(arr));
} }
stopWatch.stop(); stopWatch.stop();
System.out.println(stopWatch.prettyPrint()); Console.log(stopWatch.prettyPrint());
} }
@Data @Data