Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
TestClone.java
package com.vyazelenko.blog.copyobject;
import com.vyazelenko.blog.copyobject.primitives.clone.CloneCopy;
import java.util.ArrayList;
import java.util.List;
public class TestClone {
public static List<Copyable> results;
public static void main(String[] args) {
runTest();
}
public static void runTest() {
warmup();
test();
}
private static void warmup() {
doCopy(500_000, "warmup");
}
private static void doCopy(int iterations, String message) {
results = new ArrayList<>(iterations);
System.out.println("\n\n>>> In " + message);
for (int i = 0; i < iterations; i++) {
results.add(callCopy());
}
System.out.println("<<< " + message + " completed");
}
private int resultsHash() {
return results.hashCode();
}
private static Copyable callCopy() {
return CloneCopy.INSTANCE.copy();
}
private static void test() {
doCopy(10_000_000, "test");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.