Skip to content

Commit

Permalink
fixed jmh test
Browse files Browse the repository at this point in the history
unfortunately not matching the pre JAVA 21 tests completely
  • Loading branch information
paxel committed Oct 1, 2023
1 parent 2aa7fe0 commit 846833e
Showing 1 changed file with 14 additions and 36 deletions.
50 changes: 14 additions & 36 deletions src/test/java/paxel/lintstone/api/JmhTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,86 +30,64 @@ public class JmhTest {

@Benchmark
@OperationsPerInvocation(1000)
public void run001ActorOn001Thread() throws InterruptedException {
public void run001Actors() throws InterruptedException {
int threads = 1;
int actorCount = 1;
int messages = 1000;

run(threads, actorCount, messages, LintStoneSystemFactory.create());
run(actorCount, messages, LintStoneSystemFactory.create());
}

@Benchmark
@OperationsPerInvocation(1000)
public void run002ActorOn001Thread() throws InterruptedException {
public void run002Actors() throws InterruptedException {
int threads = 1;
int actorCount = 2;
int messages = 1000;

run(threads, actorCount, messages, LintStoneSystemFactory.create());
run(actorCount, messages, LintStoneSystemFactory.create());
}

@Benchmark
@OperationsPerInvocation(1000)
public void run010ActorOn001Thread() throws InterruptedException {
int threads = 1;
public void run010Actors() throws InterruptedException {
int actorCount = 10;
int messages = 1000;

run(threads, actorCount, messages, LintStoneSystemFactory.create());
run(actorCount, messages, LintStoneSystemFactory.create());
}

@Benchmark
@OperationsPerInvocation(1000)
public void run010ActorOn010Thread() throws InterruptedException {
int threads = 10;
int actorCount = 10;
int messages = 1000;

run(threads, actorCount, messages, LintStoneSystemFactory.create());
}

@Benchmark
@OperationsPerInvocation(1000)
public void run020ActorOn020Thread() throws InterruptedException {
int threads = 20;
public void run020Actors() throws InterruptedException {
int actorCount = 20;
int messages = 1000;

run(threads, actorCount, messages, LintStoneSystemFactory.create());
run(actorCount, messages, LintStoneSystemFactory.create());
}

@Benchmark
@OperationsPerInvocation(1000)
public void run030ActorOn020Thread() throws InterruptedException {
int threads = 20;
public void run030Actors() throws InterruptedException {
int actorCount = 30;
int messages = 1000;

run(threads, actorCount, messages, LintStoneSystemFactory.create());
run(actorCount, messages, LintStoneSystemFactory.create());
}

@Benchmark
@OperationsPerInvocation(1000)
public void run999ActorOn010Threads() throws InterruptedException {
int threads = 10;
public void run999Actors() throws InterruptedException {
int actorCount = 999;
int messages = 1000;

run(threads, actorCount, messages, LintStoneSystemFactory.create());
run(actorCount, messages, LintStoneSystemFactory.create());
}

@Benchmark
@OperationsPerInvocation(1000)
public void run999ActorOnWorkStealingThreads() throws InterruptedException {
int threads = 10;
int actorCount = 999;
int messages = 1000;

run(threads, actorCount, messages, LintStoneSystemFactory.create());
}

private void run(int threads, int actorCount, int messages, LintStoneSystem system) throws InterruptedException, UnregisteredRecipientException {
CountDownLatch latch = new CountDownLatch(threads);
private void run(int actorCount, int messages, LintStoneSystem system) throws InterruptedException, UnregisteredRecipientException {
CountDownLatch latch = new CountDownLatch(actorCount);
system.registerActor("END", () -> new EndActor(latch), ActorSettings.DEFAULT);
List<LintStoneActorAccessor> actors = new ArrayList<>();
for (int i = 0; i < actorCount; i++) {
Expand Down

0 comments on commit 846833e

Please sign in to comment.