From a84ec84903772a95ef1c825debbc3765b48c4d0f Mon Sep 17 00:00:00 2001 From: Daniel Langbein Date: Mon, 9 Dec 2024 10:40:20 +0000 Subject: [PATCH] benchmark preparations --- app/src/main/java/de/uni_marburg/powersort/TimSort.java | 4 ++-- .../main/java/de/uni_marburg/powersort/benchmark/Main.java | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/de/uni_marburg/powersort/TimSort.java b/app/src/main/java/de/uni_marburg/powersort/TimSort.java index 7d79a65..8a94942 100644 --- a/app/src/main/java/de/uni_marburg/powersort/TimSort.java +++ b/app/src/main/java/de/uni_marburg/powersort/TimSort.java @@ -61,7 +61,7 @@ import java.util.Comparator; * * @author Josh Bloch */ -class TimSort { +public class TimSort { /** * This is the minimum sized sequence that will be merged. Shorter * sequences will be lengthened by calling binarySort. If the entire @@ -209,7 +209,7 @@ class TimSort { * @param workLen usable size of work array * @since 1.8 */ - static void sort(T[] a, int lo, int hi, Comparator c, + public static void sort(T[] a, int lo, int hi, Comparator c, T[] work, int workBase, int workLen) { assert c != null && a != null && lo >= 0 && lo <= hi && hi <= a.length; diff --git a/app/src/main/java/de/uni_marburg/powersort/benchmark/Main.java b/app/src/main/java/de/uni_marburg/powersort/benchmark/Main.java index 99abb3a..da019e3 100644 --- a/app/src/main/java/de/uni_marburg/powersort/benchmark/Main.java +++ b/app/src/main/java/de/uni_marburg/powersort/benchmark/Main.java @@ -1,5 +1,7 @@ package de.uni_marburg.powersort.benchmark; +import de.uni_marburg.powersort.TimSort; + import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Arrays; @@ -25,7 +27,9 @@ public class Main { static Method[] getSortImplementations() throws NoSuchMethodException { return new Method[]{ DummySort.class.getMethod("sort", Object[].class, int.class, int.class, Comparator.class, Object[].class, int.class, int.class), - DummySort2.class.getMethod("sort", Object[].class, int.class, int.class, Comparator.class, Object[].class, int.class, int.class) + DummySort2.class.getMethod("sort", Object[].class, int.class, int.class, Comparator.class, Object[].class, int.class, int.class), + // + TimSort.class.getMethod("sort", Object[].class, int.class, int.class, Comparator.class, Object[].class, int.class, int.class), }; }