Skip to content

Commit 78300ea

Browse files
committed
1 parent dc5d713 commit 78300ea

30 files changed

+44
-200
lines changed

benchmarks/src/main/java/dev/ludovic/netlib/benchmarks/blas/l1/DaxpyBenchmark.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,9 @@ public void setup() {
4747
y = randomDoubleArray(n);
4848
}
4949

50-
@Setup(Level.Invocation)
51-
public void setupIteration() {
52-
yclone = y.clone();
53-
}
54-
5550
@Benchmark
5651
public void blas(Blackhole bh) {
57-
blas.daxpy(n, alpha, x, 1, yclone, 1);
52+
blas.daxpy(n, alpha, x, 1, yclone = y.clone(), 1);
5853
bh.consume(yclone);
5954
}
6055
}

benchmarks/src/main/java/dev/ludovic/netlib/benchmarks/blas/l1/DrotBenchmark.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,9 @@ public void setup() {
4949
s = randomDouble();
5050
}
5151

52-
@Setup(Level.Invocation)
53-
public void setupIteration() {
54-
xclone = x.clone();
55-
yclone = y.clone();
56-
}
57-
5852
@Benchmark
5953
public void blas(Blackhole bh) {
60-
blas.drot(n, xclone, 1, yclone, 1, c, s);
54+
blas.drot(n, xclone = x.clone(), 1, yclone = y.clone(), 1, c, s);
6155
bh.consume(xclone);
6256
bh.consume(yclone);
6357
}

benchmarks/src/main/java/dev/ludovic/netlib/benchmarks/blas/l1/DrotgBenchmark.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
import org.netlib.util.doubleW;
3434

3535
@State(Scope.Thread)
36+
@Warmup(iterations = 3)
37+
@Measurement(iterations = 3)
3638
public class DrotgBenchmark extends L1Benchmark {
3739

3840
public doubleW sa, saclone;
@@ -48,17 +50,9 @@ public void setup() {
4850
s = new doubleW(randomDouble());
4951
}
5052

51-
@Setup(Level.Invocation)
52-
public void setupIteration() {
53-
saclone = new doubleW(sa.val);
54-
sbclone = new doubleW(sb.val);
55-
cclone = new doubleW(c.val);
56-
sclone = new doubleW(s.val);
57-
}
58-
5953
@Benchmark
6054
public void blas(Blackhole bh) {
61-
blas.drotg(saclone, sbclone, cclone, sclone);
55+
blas.drotg(saclone = new doubleW(sa.val), sbclone = new doubleW(sb.val), cclone = new doubleW(c.val), sclone = new doubleW(s.val));
6256
bh.consume(saclone);
6357
bh.consume(sbclone);
6458
bh.consume(cclone);

benchmarks/src/main/java/dev/ludovic/netlib/benchmarks/blas/l1/DscalBenchmark.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,9 @@ public void setup() {
4545
x = randomDoubleArray(n);
4646
}
4747

48-
@Setup(Level.Invocation)
49-
public void setupIteration() {
50-
xclone = x.clone();
51-
}
52-
5348
@Benchmark
5449
public void blas(Blackhole bh) {
55-
blas.dscal(n, alpha, xclone, 1);
50+
blas.dscal(n, alpha, xclone = x.clone(), 1);
5651
bh.consume(xclone);
5752
}
5853
}

benchmarks/src/main/java/dev/ludovic/netlib/benchmarks/blas/l1/DswapBenchmark.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,9 @@ public void setup() {
4545
y = randomDoubleArray(n);
4646
}
4747

48-
@Setup(Level.Invocation)
49-
public void setupIteration() {
50-
xclone = x.clone();
51-
yclone = y.clone();
52-
}
53-
5448
@Benchmark
5549
public void blas(Blackhole bh) {
56-
blas.dswap(n, xclone, 1, yclone, 1);
50+
blas.dswap(n, xclone = x.clone(), 1, yclone = y.clone(), 1);
5751
bh.consume(xclone);
5852
bh.consume(yclone);
5953
}

benchmarks/src/main/java/dev/ludovic/netlib/benchmarks/blas/l1/SaxpyBenchmark.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,9 @@ public void setup() {
4747
y = randomFloatArray(n);
4848
}
4949

50-
@Setup(Level.Invocation)
51-
public void setupIteration() {
52-
yclone = y.clone();
53-
}
54-
5550
@Benchmark
5651
public void blas(Blackhole bh) {
57-
blas.saxpy(n, alpha, x, 1, yclone, 1);
52+
blas.saxpy(n, alpha, x, 1, yclone = y.clone(), 1);
5853
bh.consume(yclone);
5954
}
6055
}

benchmarks/src/main/java/dev/ludovic/netlib/benchmarks/blas/l1/SrotBenchmark.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,9 @@ public void setup() {
4949
s = randomFloat();
5050
}
5151

52-
@Setup(Level.Invocation)
53-
public void setupIteration() {
54-
xclone = x.clone();
55-
yclone = y.clone();
56-
}
57-
5852
@Benchmark
5953
public void blas(Blackhole bh) {
60-
blas.srot(n, xclone, 1, yclone, 1, c, s);
54+
blas.srot(n, xclone = x.clone(), 1, yclone = y.clone(), 1, c, s);
6155
bh.consume(xclone);
6256
bh.consume(yclone);
6357
}

benchmarks/src/main/java/dev/ludovic/netlib/benchmarks/blas/l1/SrotgBenchmark.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
import org.netlib.util.floatW;
3434

3535
@State(Scope.Thread)
36+
@Warmup(iterations = 3)
37+
@Measurement(iterations = 3)
3638
public class SrotgBenchmark extends L1Benchmark {
3739

3840
public floatW sa, saclone;
@@ -48,17 +50,9 @@ public void setup() {
4850
s = new floatW(randomFloat());
4951
}
5052

51-
@Setup(Level.Invocation)
52-
public void setupIteration() {
53-
saclone = new floatW(sa.val);
54-
sbclone = new floatW(sb.val);
55-
cclone = new floatW(c.val);
56-
sclone = new floatW(s.val);
57-
}
58-
5953
@Benchmark
6054
public void blas(Blackhole bh) {
61-
blas.srotg(saclone, sbclone, cclone, sclone);
55+
blas.srotg(saclone = new floatW(sa.val), sbclone = new floatW(sb.val), cclone = new floatW(c.val), sclone = new floatW(s.val));
6256
bh.consume(saclone);
6357
bh.consume(sbclone);
6458
bh.consume(cclone);

benchmarks/src/main/java/dev/ludovic/netlib/benchmarks/blas/l1/SscalBenchmark.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,9 @@ public void setup() {
4545
x = randomFloatArray(n);
4646
}
4747

48-
@Setup(Level.Invocation)
49-
public void setupIteration() {
50-
xclone = x.clone();
51-
}
52-
5348
@Benchmark
5449
public void blas(Blackhole bh) {
55-
blas.sscal(n, alpha, xclone, 1);
50+
blas.sscal(n, alpha, xclone = x.clone(), 1);
5651
bh.consume(xclone);
5752
}
5853
}

benchmarks/src/main/java/dev/ludovic/netlib/benchmarks/blas/l1/SswapBenchmark.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,9 @@ public void setup() {
4545
y = randomFloatArray(n);
4646
}
4747

48-
@Setup(Level.Invocation)
49-
public void setupIteration() {
50-
xclone = x.clone();
51-
yclone = y.clone();
52-
}
53-
5448
@Benchmark
5549
public void blas(Blackhole bh) {
56-
blas.sswap(n, xclone, 1, yclone, 1);
50+
blas.sswap(n, xclone = x.clone(), 1, yclone = y.clone(), 1);
5751
bh.consume(xclone);
5852
bh.consume(yclone);
5953
}

0 commit comments

Comments
 (0)