Skip to content

Commit c8e767b

Browse files
committed
Test more @inline options
Add -optimise flag. `jmh:run -t1 -f 1 -wi 5 -i 5 ImplicitClassTest` scala 2.11.8 ``` baseline avgt 5 3.196 ± 0.218 ns/op testClassAnyVal avgt 5 3.159 ± 0.303 ns/op testClassImplicitInlineClassAnyVal avgt 5 3.270 ± 0.138 ns/op testClassImplicitInlineFunAnyVal avgt 5 3.362 ± 0.150 ns/op testClassInlineBothAnyVal avgt 5 3.239 ± 0.054 ns/op testClassStandard avgt 5 3.193 ± 0.283 ns/op testFunctionAnyVal avgt 5 3.164 ± 0.143 ns/op testFunctionInlineAnyVal avgt 5 3.262 ± 0.051 ns/op testFunctionStandard avgt 5 3.355 ± 0.283 ns/op ``` scala 2.12.1 ``` baseline avgt 5 3.213 ± 0.125 ns/op testClassAnyVal avgt 5 3.817 ± 0.310 ns/op testClassImplicitInlineClassAnyVal avgt 5 3.853 ± 0.235 ns/op testClassImplicitInlineFunAnyVal avgt 5 3.869 ± 0.187 ns/op testClassInlineBothAnyVal avgt 5 3.782 ± 0.259 ns/op testClassStandard avgt 5 3.633 ± 0.261 ns/op testFunctionAnyVal avgt 5 3.860 ± 0.217 ns/op testFunctionInlineAnyVal avgt 5 3.853 ± 0.264 ns/op testFunctionStandard avgt 5 3.597 ± 0.067 ns/op ```
1 parent 916eac9 commit c8e767b

40 files changed

+4545
-4
lines changed

build.sbt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@ libraryDependencies ++= Seq(
99
// "group" % "artifact" % "version"
1010
)
1111

12+
scalacOptions := Seq("-optimise")
13+
1214
enablePlugins(JmhPlugin)

jad_scala_2_11_8/AnyValTest.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
2+
// Jad home page: http://www.kpdus.com/jad.html
3+
// Decompiler options: packimports(3)
4+
// Source File Name: AnyValTest.scala
5+
6+
package org.openjdk.jmh.samples;
7+
8+
9+
// Referenced classes of package org.openjdk.jmh.samples:
10+
// Without
11+
12+
public class AnyValTest
13+
{
14+
15+
public Without testWithout()
16+
{
17+
return new Without(42);
18+
}
19+
20+
public int testWithit()
21+
{
22+
return 42;
23+
}
24+
25+
public AnyValTest()
26+
{
27+
}
28+
}

jad_scala_2_11_8/BitOpsTest.java

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
2+
// Jad home page: http://www.kpdus.com/jad.html
3+
// Decompiler options: packimports(3)
4+
// Source File Name: BitOpsTest.scala
5+
6+
package org.openjdk.jmh.samples;
7+
8+
import org.lila.clockencoder.BitReader;
9+
import scala.Serializable;
10+
import scala.collection.immutable.*;
11+
import scala.package$;
12+
import scala.runtime.BoxesRunTime;
13+
import scala.util.Random;
14+
15+
// Referenced classes of package org.openjdk.jmh.samples:
16+
// EncodingTestData
17+
18+
public class BitOpsTest
19+
implements EncodingTestData
20+
{
21+
22+
public Random org$openjdk$jmh$samples$EncodingTestData$$r()
23+
{
24+
return org$openjdk$jmh$samples$EncodingTestData$$r;
25+
}
26+
27+
public int startTime()
28+
{
29+
return startTime;
30+
}
31+
32+
public int[] centis()
33+
{
34+
return centis;
35+
}
36+
37+
public int moves()
38+
{
39+
return moves;
40+
}
41+
42+
public int[] trunced()
43+
{
44+
return trunced;
45+
}
46+
47+
public int[] encodedRounds()
48+
{
49+
return encodedRounds;
50+
}
51+
52+
public byte[] encoded()
53+
{
54+
return encoded;
55+
}
56+
57+
public void org$openjdk$jmh$samples$EncodingTestData$_setter_$org$openjdk$jmh$samples$EncodingTestData$$r_$eq(Random x$1)
58+
{
59+
org$openjdk$jmh$samples$EncodingTestData$$r = x$1;
60+
}
61+
62+
public void org$openjdk$jmh$samples$EncodingTestData$_setter_$startTime_$eq(int x$1)
63+
{
64+
startTime = x$1;
65+
}
66+
67+
public void org$openjdk$jmh$samples$EncodingTestData$_setter_$centis_$eq(int x$1[])
68+
{
69+
centis = x$1;
70+
}
71+
72+
public void org$openjdk$jmh$samples$EncodingTestData$_setter_$moves_$eq(int x$1)
73+
{
74+
moves = x$1;
75+
}
76+
77+
public void org$openjdk$jmh$samples$EncodingTestData$_setter_$trunced_$eq(int x$1[])
78+
{
79+
trunced = x$1;
80+
}
81+
82+
public void org$openjdk$jmh$samples$EncodingTestData$_setter_$encodedRounds_$eq(int x$1[])
83+
{
84+
encodedRounds = x$1;
85+
}
86+
87+
public void org$openjdk$jmh$samples$EncodingTestData$_setter_$encoded_$eq(byte x$1[])
88+
{
89+
encoded = x$1;
90+
}
91+
92+
public IndexedSeq testRead()
93+
{
94+
BitReader r = new BitReader(encoded());
95+
return (IndexedSeq)package$.MODULE$.Range().apply(0, 50).map(new Serializable(r) {
96+
97+
public final int apply(int x$1)
98+
{
99+
return r$1.readBits(4);
100+
}
101+
102+
public int apply$mcII$sp(int x$1)
103+
{
104+
return r$1.readBits(4);
105+
}
106+
107+
public final volatile Object apply(Object v1)
108+
{
109+
return BoxesRunTime.boxToInteger(apply(BoxesRunTime.unboxToInt(v1)));
110+
}
111+
112+
public static final long serialVersionUID = 0L;
113+
public final BitReader r$1;
114+
115+
public
116+
{
117+
this.r$1 = r$1;
118+
super();
119+
}
120+
}
121+
, IndexedSeq$.MODULE$.canBuildFrom());
122+
}
123+
124+
public BitOpsTest()
125+
{
126+
EncodingTestData.class.$init$(this);
127+
}
128+
129+
private final Random org$openjdk$jmh$samples$EncodingTestData$$r;
130+
private final int startTime;
131+
private final int centis[];
132+
private final int moves;
133+
private final int trunced[];
134+
private final int encodedRounds[];
135+
private final byte encoded[];
136+
}

jad_scala_2_11_8/Centis$.java

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
2+
// Jad home page: http://www.kpdus.com/jad.html
3+
// Decompiler options: packimports(3)
4+
// Source File Name: DurationConvertTest.scala
5+
6+
package org.openjdk.jmh.samples;
7+
8+
import scala.*;
9+
import scala.collection.Iterator;
10+
import scala.runtime.*;
11+
12+
// Referenced classes of package org.openjdk.jmh.samples:
13+
// Centis
14+
15+
public final class Centis$ extends AbstractFunction1
16+
implements Serializable
17+
{
18+
19+
public final String toString()
20+
{
21+
return "Centis";
22+
}
23+
24+
public int apply(int cs)
25+
{
26+
return cs;
27+
}
28+
29+
public Option unapply(int x$0)
30+
{
31+
new Centis(x$0);
32+
return new Some(BoxesRunTime.boxToInteger(x$0));
33+
}
34+
35+
private Object readResolve()
36+
{
37+
return MODULE$;
38+
}
39+
40+
public final int copy$extension(int $this, int cs)
41+
{
42+
return cs;
43+
}
44+
45+
public final int copy$default$1$extension(int $this)
46+
{
47+
return $this;
48+
}
49+
50+
public final String productPrefix$extension(int $this)
51+
{
52+
return "Centis";
53+
}
54+
55+
public final int productArity$extension(int $this)
56+
{
57+
return 1;
58+
}
59+
60+
public final Object productElement$extension(int $this, int x$1)
61+
{
62+
switch(x$1)
63+
{
64+
default:
65+
throw new IndexOutOfBoundsException(BoxesRunTime.boxToInteger(x$1).toString());
66+
67+
case 0: // '\0'
68+
return BoxesRunTime.boxToInteger($this);
69+
}
70+
}
71+
72+
public final Iterator productIterator$extension(int $this)
73+
{
74+
return ScalaRunTime$.MODULE$.typedProductIterator(new Centis($this));
75+
}
76+
77+
public final boolean canEqual$extension(int $this, Object x$1)
78+
{
79+
return x$1 instanceof Integer;
80+
}
81+
82+
public final int hashCode$extension(int $this)
83+
{
84+
return BoxesRunTime.boxToInteger($this).hashCode();
85+
}
86+
87+
public final boolean equals$extension(int $this, Object x$1)
88+
{
89+
boolean flag;
90+
if(x$1 instanceof Centis)
91+
flag = true;
92+
else
93+
flag = false;
94+
if(!flag) goto _L2; else goto _L1
95+
_L1:
96+
int i = ((Centis)x$1).cs();
97+
if($this != i) goto _L2; else goto _L3
98+
_L3:
99+
true;
100+
goto _L4
101+
_L2:
102+
false;
103+
_L4:
104+
return;
105+
}
106+
107+
public final String toString$extension(int $this)
108+
{
109+
return ScalaRunTime$.MODULE$._toString(new Centis($this));
110+
}
111+
112+
public volatile Object apply(Object v1)
113+
{
114+
return new Centis(apply(BoxesRunTime.unboxToInt(v1)));
115+
}
116+
117+
private Centis$()
118+
{
119+
}
120+
121+
public static final Centis$ MODULE$ = this;
122+
123+
static
124+
{
125+
new Centis$();
126+
}
127+
}

0 commit comments

Comments
 (0)