Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ plugins {
`maven-publish`

alias(libs.plugins.nyx)
alias(libs.plugins.jmh)
alias(libs.plugins.axion.release)
}

Expand Down Expand Up @@ -96,7 +97,7 @@ repositories {
dependencies {
api(libs.jetbrains.annotations)
implementation(libs.slf4j.api)

jmh(libs.slf4j.simple)
testImplementation(libs.bundles.junit)
}

Expand Down
3 changes: 2 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[versions]
nyx = "0.2.3"
jmh = "0.7.2"
jmh = "0.7.3"
axion-release = "1.18.12"

jetbrains-annotations = "26.0.1"
Expand All @@ -22,6 +22,7 @@ axion-release = { id = "pl.allegro.tech.build.axion-release", version.ref = "axi
jetbrains-annotations = { group = "org.jetbrains", name = "annotations", version.ref = "jetbrains-annotations" }

slf4j-api = { group = "org.slf4j", name = "slf4j-api", version.ref = "slf4j-api" }
slf4j-simple = { group = "org.slf4j", name = "slf4j-simple", version.ref = "slf4j-api" }

junit-jupiter-api = { group = "org.junit.jupiter", name = "junit-jupiter-api", version.ref = "junit-jupiter" }
junit-jupiter-engine = { group = "org.junit.jupiter", name = "junit-jupiter-engine", version.ref = "junit-jupiter" }
Expand Down
9 changes: 8 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
rootProject.name = "seismic"
rootProject.name = "seismic"

pluginManagement {
repositories {
gradlePluginPortal()
mavenCentral()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.dfsek.seismic.algorithms.sampler.noise;

import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Group;
import org.openjdk.jmh.annotations.Measurement;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.Warmup;

@State(Scope.Benchmark)
public class CellularSamplerBenchmark {
private final NoiseFunction cellular = new CellularSampler();

@Benchmark
@Group("cellular")
@Fork(1)
@Warmup(iterations = 1, time = 1)
@Measurement(iterations = 2, time = 5)
public void benchmarkCellular3D() {
cellular.getNoiseRaw(0, 0, 0, 0);
}

@Benchmark
@Group("cellular")
@Fork(1)
@Warmup(iterations = 1, time = 1)
@Measurement(iterations = 2, time = 5)
public void benchmarkCellular2D() {
cellular.getNoiseRaw(0, 0, 0);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.dfsek.seismic.math.trigonometry;

import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Measurement;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.Warmup;


@State(Scope.Benchmark)
public class TrigonometricFunctionsBenchmark {
@Benchmark
@Fork(1)
@Warmup(iterations = 1, time = 1)
@Measurement(iterations = 2, time = 5)
public void benchmarkAtan2Java() {
double _x = Math.atan2(1.0, 1.0);
}

@Benchmark
@Fork(1)
@Warmup(iterations = 1, time = 1)
@Measurement(iterations = 2, time = 5)
public void benchmarkAtan2Fast() {
double _x = TrigonometryFunctions.fastAtan2(1, 1);
}
}
Loading