Skip to content
Permalink
Browse files
8234084: [TEST_BUG] Remove unexecuted performance benchmark tests
Reviewed-by: kcr
  • Loading branch information
arapte committed Apr 21, 2021
1 parent 49d2126 commit 8f0062d79693914800fd20381d61069e205ee133
Showing with 0 additions and 187 deletions.
  1. +0 −187 modules/javafx.graphics/src/test/java/test/javafx/scene/input/TouchEventTest.java
@@ -42,7 +42,6 @@
import javafx.scene.input.TouchEvent;
import javafx.scene.input.TouchPoint;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import static org.junit.Assert.*;

@@ -1548,190 +1547,4 @@ private Scene createScene() {

return scene;
}

@Test
@Ignore("JDK-8234084") // This is a benchmark, not any functional test.
public void saneOrderingBenchmark() {
long[] ids = new long[] { 2, 3, 4, 5, 6 };
boolean[] active = new boolean[] { false, false, false, false, false };
int count = 0;
int tick = 5;
int available = 5;
Random rand = new Random();

Scene scene = createScene();


int ticker = 0;
int added = -1;
int removed = -1;
long timer = System.currentTimeMillis();
for (int i = 0; i < SANE_BENCHMARK_CYCLES; i++) {
ticker++;
if (ticker == tick) {
ticker = 0;

boolean up;
if (count == available) {
up = false;
} else if (count == 0) {
up = true;
} else {
up = Math.random() > 0.4;
}

if (up) {
for (int j = 0; j < available; j++) {
if (!active[j]) {
active[j] = true;
added = j;
count++;
break;
}
}
} else {
int which = rand.nextInt(count);
int k = 0;
for (int j = 0; j < available; j++) {
if (active[j]) {
k++;
if (k == which) {
active[j] = false;
removed = j;
count--;
break;
}
}
}
}
}

int reporting = count + (removed >= 0 ? 1 : 0);

((StubScene) SceneHelper.getPeer(scene)).getListener().touchEventBegin(
System.currentTimeMillis(), reporting, true, false, false, false, false);

for (int j = 0; j < available; j++) {
if (active[j] || removed == j) {
TouchPoint.State state = TouchPoint.State.MOVED;
if (added == j) {
state = TouchPoint.State.PRESSED;
} else if (removed == j) {
state = TouchPoint.State.RELEASED;
} else {
}

((StubScene) SceneHelper.getPeer(scene)).getListener().touchEventNext(
state, ids[j], 150, 150, 150, 150);
}
}

((StubScene) SceneHelper.getPeer(scene)).getListener().touchEventEnd();
removed = -1;
added = -1;
}
long timer2 = System.currentTimeMillis();
System.out.println("*************************************************");
System.out.println("Benchmark1 time: " + (timer2 - timer));
System.out.println("*************************************************");
System.out.println("");
}

@Test
@Ignore("JDK-8234084") // This is a benchmark, not any functional test.
public void crazyOrderingBenchmark() {
long[] ids = new long[] { 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000 };
boolean[] active = new boolean[] { false, false, false, false, false,
false, false, false, false, false };
int count = 0;
int tick = 5;
int available = 10;
Random rand = new Random();

Scene scene = createScene();


int ticker = 0;
int added = -1;
int removed = -1;
long timer = System.currentTimeMillis();
for (int i = 0; i < CRAZY_BENCHMARK_CYCLES; i++) {
ticker++;
if (ticker == tick) {
ticker = 0;

boolean up;
if (count == available) {
up = false;
} else if (count == 0) {
up = true;
} else {
up = Math.random() > 0.4;
}

if (up) {
int which = rand.nextInt(available - count);
int k = 0;
for (int j = 0; j < available; j++) {
if (!active[j]) {
k++;
if (k == which) {
active[j] = true;
added = j;
count++;
ids[j] = Math.abs(rand.nextLong());
if (ids[j] == 0) {
ids[j] = 1;
}
break;
}
}
}
} else {
int which = rand.nextInt(count);
int k = 0;
for (int j = 0; j < available; j++) {
if (active[j]) {
k++;
if (k == which) {
active[j] = false;
removed = j;
count--;
break;
}
}
}
}
}

int reporting = count + (removed >= 0 ? 1 : 0);

((StubScene) SceneHelper.getPeer(scene)).getListener().touchEventBegin(
System.currentTimeMillis(), reporting, true, false, false, false, false);

for (int j = 0; j < available; j++) {
if (active[j] || removed == j) {
TouchPoint.State state = TouchPoint.State.MOVED;
if (added == j) {
state = TouchPoint.State.PRESSED;
} else if (removed == j) {
state = TouchPoint.State.RELEASED;
}

((StubScene) SceneHelper.getPeer(scene)).getListener().touchEventNext(
state, ids[j], 150, 150, 150, 150);
}
}

((StubScene) SceneHelper.getPeer(scene)).getListener().touchEventEnd();
removed = -1;
added = -1;
}
long timer2 = System.currentTimeMillis();
System.out.println("*************************************************");
System.out.println("Benchmark2 time: " + (timer2 - timer));
System.out.println("*************************************************");
System.out.println("");
}

}

1 comment on commit 8f0062d

@openjdk-notifier

This comment has been minimized.

Copy link

@openjdk-notifier openjdk-notifier bot commented on 8f0062d Apr 21, 2021

Please sign in to comment.