Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 148059

Summary: [cleanup] org.eclipse.jdt.internal.core.util.Util should not define its own sort methods
Product: [Eclipse Project] JDT Reporter: Olivier Thomann <Olivier_Thomann>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3    
Version: 3.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: stalebug

Description Olivier Thomann CLA 2006-06-21 11:34:26 EDT
This class defines some sort methods that seem to be slower than the ones defined in java.util.Arrays.
So we could get rid of all the sort methods and the two interfaces Util.Comparable and Util.Comparer.
Comment 1 Olivier Thomann CLA 2006-06-26 16:19:58 EDT
I used the following code to check the speed.

import java.util.Arrays;
import java.util.Random;

import org.eclipse.jdt.internal.core.util.Util;

public class CompareStats {
	private static final int TAB_SIZE = 100000;

	public static void main(String[] args) {
		Random random = new Random();
		int[] tab = new int[TAB_SIZE];
		for (int i = 0; i < TAB_SIZE; i++) {
			tab[i] = random.nextInt();
		}
		int[] tab2 = new int[TAB_SIZE];
		System.arraycopy(tab, 0, tab2, 0, TAB_SIZE);
		long time = System.currentTimeMillis();
		Util.sort(tab);
		System.out.println("Util.sort(...) " + (System.currentTimeMillis() - time) + "ms spent "); //$NON-NLS-1$//$NON-NLS-2$
		time = System.currentTimeMillis();
		Arrays.sort(tab2);
		System.out.println("Arrays.sort(...) " + (System.currentTimeMillis() - time) + "ms spent "); //$NON-NLS-1$//$NON-NLS-2$
		time = System.currentTimeMillis();
		Util.sort(tab);
		System.out.println("Util.sort(...) " + (System.currentTimeMillis() - time) + "ms spent "); //$NON-NLS-1$//$NON-NLS-2$
		time = System.currentTimeMillis();
		Arrays.sort(tab2);
		System.out.println("Arrays.sort(...) " + (System.currentTimeMillis() - time) + "ms spent "); //$NON-NLS-1$//$NON-NLS-2$
	}
}
Comment 2 Eclipse Genie CLA 2019-09-25 18:21:43 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.