Skip to content
This repository was archived by the owner on Aug 21, 2020. It is now read-only.

Commit 7a2f3cc

Browse files
committed
Initial benchmark
1 parent 582eb68 commit 7a2f3cc

File tree

11 files changed

+337
-5
lines changed

11 files changed

+337
-5
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "citylots"]
2+
path = citylots
3+
url = https://github.com/zemirco/sf-city-lots-json

0.10/jmh-result.json

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
[
2+
{
3+
"jmhVersion" : "1.21",
4+
"benchmark" : "fs2.benchmarks.TextParsingBenchmark.parseBigFileSync",
5+
"mode" : "avgt",
6+
"threads" : 2,
7+
"forks" : 5,
8+
"jvm" : "/Library/Java/JavaVirtualMachines/jdk1.8.0_162.jdk/Contents/Home/jre/bin/java",
9+
"jvmArgs" : [
10+
],
11+
"jdkVersion" : "1.8.0_162",
12+
"vmName" : "Java HotSpot(TM) 64-Bit Server VM",
13+
"vmVersion" : "25.162-b12",
14+
"warmupIterations" : 5,
15+
"warmupTime" : "10 s",
16+
"warmupBatchSize" : 1,
17+
"measurementIterations" : 5,
18+
"measurementTime" : "10 s",
19+
"measurementBatchSize" : 1,
20+
"primaryMetric" : {
21+
"score" : 2537.4488413436666,
22+
"scoreError" : 427.31025725862776,
23+
"scoreConfidence" : [
24+
2110.138584085039,
25+
2964.759098602294
26+
],
27+
"scorePercentiles" : {
28+
"0.0" : 1989.4461826166666,
29+
"50.0" : 2294.019813,
30+
"90.0" : 3325.0457861749996,
31+
"95.0" : 3943.312243241666,
32+
"99.0" : 4174.4465881666665,
33+
"99.9" : 4174.4465881666665,
34+
"99.99" : 4174.4465881666665,
35+
"99.999" : 4174.4465881666665,
36+
"99.9999" : 4174.4465881666665,
37+
"100.0" : 4174.4465881666665
38+
},
39+
"scoreUnit" : "ms/op",
40+
"rawData" : [
41+
[
42+
2577.221836625,
43+
2749.8853525,
44+
2954.3875127916667,
45+
2832.0401584166666,
46+
2786.262234208333
47+
],
48+
[
49+
3272.4104624583333,
50+
3172.993176541667,
51+
3169.2563064166666,
52+
4174.4465881666665,
53+
3403.99877175
54+
],
55+
[
56+
2684.1471035,
57+
2374.4616703499996,
58+
2230.2114145,
59+
2294.019813,
60+
2232.3558109
61+
],
62+
[
63+
2024.28714545,
64+
1989.4461826166666,
65+
2042.63728275,
66+
1992.2067982833332,
67+
1990.5823448166666
68+
],
69+
[
70+
2094.204114125,
71+
2117.34441745,
72+
2087.9950496,
73+
2092.891651775,
74+
2096.5278346
75+
]
76+
]
77+
},
78+
"secondaryMetrics" : {
79+
}
80+
}
81+
]
82+
83+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package fs2
2+
package benchmarks
3+
4+
import cats.effect.IO
5+
import org.openjdk.jmh.annotations.{Benchmark, BenchmarkMode, Mode, OutputTimeUnit, Scope, State}
6+
import java.util.concurrent.TimeUnit
7+
8+
@State(Scope.Thread)
9+
class TextParsingBenchmark {
10+
11+
@Benchmark @BenchmarkMode(Array(Mode.AverageTime)) @OutputTimeUnit(TimeUnit.MILLISECONDS)
12+
def parseBigFileSync: Int = {
13+
fs2.io.file.readAll[IO](TestData.largeJsonFile, 2048).through(text.utf8Decode).through(text.lines).compile.fold(0)((acc, _) => acc + 1).unsafeRunSync
14+
}
15+
}

0.9/jmh-result.json

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
[
2+
{
3+
"jmhVersion" : "1.21",
4+
"benchmark" : "fs2.benchmarks.TextParsingBenchmark.parseBigFileSync",
5+
"mode" : "avgt",
6+
"threads" : 2,
7+
"forks" : 5,
8+
"jvm" : "/Library/Java/JavaVirtualMachines/jdk1.8.0_162.jdk/Contents/Home/jre/bin/java",
9+
"jvmArgs" : [
10+
],
11+
"jdkVersion" : "1.8.0_162",
12+
"vmName" : "Java HotSpot(TM) 64-Bit Server VM",
13+
"vmVersion" : "25.162-b12",
14+
"warmupIterations" : 5,
15+
"warmupTime" : "10 s",
16+
"warmupBatchSize" : 1,
17+
"measurementIterations" : 5,
18+
"measurementTime" : "10 s",
19+
"measurementBatchSize" : 1,
20+
"primaryMetric" : {
21+
"score" : 5493.72610868,
22+
"scoreError" : 708.931456072602,
23+
"scoreConfidence" : [
24+
4784.794652607397,
25+
6202.657564752602
26+
],
27+
"scorePercentiles" : {
28+
"0.0" : 4991.42913325,
29+
"50.0" : 5219.9996895,
30+
"90.0" : 5792.70368505,
31+
"95.0" : 8711.484653724998,
32+
"99.0" : 9882.30397825,
33+
"99.9" : 9882.30397825,
34+
"99.99" : 9882.30397825,
35+
"99.999" : 9882.30397825,
36+
"99.9999" : 9882.30397825,
37+
"100.0" : 9882.30397825
38+
},
39+
"scoreUnit" : "ms/op",
40+
"rawData" : [
41+
[
42+
5230.2015222499995,
43+
5272.8253405,
44+
5214.087841750001,
45+
9882.30397825,
46+
5167.312001
47+
],
48+
[
49+
5118.66426325,
50+
5101.3940855,
51+
5068.957499,
52+
5096.63754975,
53+
5056.21900125
54+
],
55+
[
56+
5190.4242225,
57+
5217.392346,
58+
5219.463632999999,
59+
5230.2016165000005,
60+
5219.9996895
61+
],
62+
[
63+
5531.0125017499995,
64+
5550.84379375,
65+
5547.663382250001,
66+
5529.2089495,
67+
5600.548483250001
68+
],
69+
[
70+
5979.5728965,
71+
5582.8959052499995,
72+
5668.12421075,
73+
5075.76887075,
74+
4991.42913325
75+
]
76+
]
77+
},
78+
"secondaryMetrics" : {
79+
}
80+
}
81+
]
82+
83+
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package fs2
2+
package benchmarks
3+
4+
import org.openjdk.jmh.annotations.{Benchmark, BenchmarkMode, Mode, OutputTimeUnit, Scope, State}
5+
import java.util.concurrent.TimeUnit
6+
7+
@State(Scope.Thread)
8+
class TextParsingBenchmark {
9+
10+
@Benchmark @BenchmarkMode(Array(Mode.AverageTime)) @OutputTimeUnit(TimeUnit.MILLISECONDS)
11+
def parseBigFileSync: Int = {
12+
fs2.io.file.readAll[Task](TestData.largeJsonFile, 2048).through(text.utf8Decode).through(text.lines).runFold(0)((acc, _) => acc + 1).unsafeRun
13+
}
14+
}

1.0/jmh-result.json

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
[
2+
{
3+
"jmhVersion" : "1.21",
4+
"benchmark" : "fs2.benchmarks.TextParsingBenchmark.parseBigFileSync",
5+
"mode" : "avgt",
6+
"threads" : 2,
7+
"forks" : 5,
8+
"jvm" : "/Library/Java/JavaVirtualMachines/jdk1.8.0_162.jdk/Contents/Home/jre/bin/java",
9+
"jvmArgs" : [
10+
],
11+
"jdkVersion" : "1.8.0_162",
12+
"vmName" : "Java HotSpot(TM) 64-Bit Server VM",
13+
"vmVersion" : "25.162-b12",
14+
"warmupIterations" : 5,
15+
"warmupTime" : "10 s",
16+
"warmupBatchSize" : 1,
17+
"measurementIterations" : 5,
18+
"measurementTime" : "10 s",
19+
"measurementBatchSize" : 1,
20+
"primaryMetric" : {
21+
"score" : 2631.641332060666,
22+
"scoreError" : 363.95234010737306,
23+
"scoreConfidence" : [
24+
2267.688991953293,
25+
2995.593672168039
26+
],
27+
"scorePercentiles" : {
28+
"0.0" : 2314.457436875,
29+
"50.0" : 2547.127257541667,
30+
"90.0" : 2974.701416458333,
31+
"95.0" : 4219.585026716666,
32+
"99.0" : 4683.532314666667,
33+
"99.9" : 4683.532314666667,
34+
"99.99" : 4683.532314666667,
35+
"99.999" : 4683.532314666667,
36+
"99.9999" : 4683.532314666667,
37+
"100.0" : 4683.532314666667
38+
},
39+
"scoreUnit" : "ms/op",
40+
"rawData" : [
41+
[
42+
2368.7861941,
43+
2390.1491899000002,
44+
2859.0400502083335,
45+
2360.2245947,
46+
2344.721728475
47+
],
48+
[
49+
2848.5309834166665,
50+
2567.75610465,
51+
2547.127257541667,
52+
2621.784171875,
53+
2621.5885962499997
54+
],
55+
[
56+
3137.0413548333336,
57+
2793.791550125,
58+
2786.5905701666666,
59+
2866.4747908749996,
60+
4683.532314666667
61+
],
62+
[
63+
2314.457436875,
64+
2328.884329775,
65+
2323.6298365000002,
66+
2342.48446815,
67+
2352.06514285
68+
],
69+
[
70+
2365.455649525,
71+
2688.8201734583336,
72+
2610.4247800000003,
73+
2335.414996025,
74+
2332.257036575
75+
]
76+
]
77+
},
78+
"secondaryMetrics" : {
79+
}
80+
}
81+
]
82+
83+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package fs2
2+
package benchmarks
3+
4+
import cats.effect.IO
5+
import org.openjdk.jmh.annotations.{Benchmark, BenchmarkMode, Mode, OutputTimeUnit, Scope, State}
6+
import java.util.concurrent.TimeUnit
7+
8+
@State(Scope.Thread)
9+
class TextParsingBenchmark {
10+
11+
@Benchmark @BenchmarkMode(Array(Mode.AverageTime)) @OutputTimeUnit(TimeUnit.MILLISECONDS)
12+
def parseBigFileSync: Int = {
13+
fs2.io.file.readAll[IO](TestData.largeJsonFile, 2048).through(text.utf8Decode).through(text.lines).compile.fold(0)((acc, _) => acc + 1).unsafeRunSync
14+
}
15+
}

build.sbt

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
lazy val commonSettings = Seq(
2+
resolvers += Resolver.sonatypeRepo("snapshots"),
23
organization := "co.fs2",
34
scalaVersion := "2.12.6",
45
scalacOptions ++= Seq(
@@ -24,9 +25,34 @@ lazy val commonSettings = Seq(
2425
scalacOptions in (Test, console) := (scalacOptions in (Compile, console)).value
2526
)
2627

27-
lazy val root = project.in(file(".")).settings(commonSettings).aggregate(zeroNine, zeroTen, oneZero)
28+
addCommandAlias("benchmark", s"jmh:run -rf json -t 2 -wi 5 -i 5")
2829

29-
lazy val zeroNine = project.in(file("0.9")).settings(commonSettings)
30-
lazy val zeroTen = project.in(file("0.10")).settings(commonSettings)
31-
lazy val oneZero = project.in(file("1.0")).settings(commonSettings)
30+
lazy val root = project.in(file(".")).
31+
settings(commonSettings).
32+
aggregate(zeroNine, zeroTen, oneZero)
3233

34+
lazy val common = project.in(file("common")).settings(commonSettings)
35+
36+
lazy val zeroNine = project.in(file("0.9")).
37+
enablePlugins(JmhPlugin).
38+
dependsOn(common).
39+
settings(commonSettings).
40+
settings(
41+
libraryDependencies += "co.fs2" %% "fs2-io" % "0.9.6"
42+
)
43+
44+
lazy val zeroTen = project.in(file("0.10")).
45+
enablePlugins(JmhPlugin).
46+
dependsOn(common).
47+
settings(commonSettings).
48+
settings(
49+
libraryDependencies += "co.fs2" %% "fs2-io" % "0.10.5"
50+
)
51+
52+
lazy val oneZero = project.in(file("1.0")).
53+
enablePlugins(JmhPlugin).
54+
dependsOn(common).
55+
settings(commonSettings).
56+
settings(
57+
libraryDependencies += "co.fs2" %% "fs2-io" % "1.0.0-SNAPSHOT"
58+
)

citylots

Submodule citylots added at 33c27c1
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package fs2
2+
package benchmarks
3+
4+
import java.nio.file.{Path, Paths}
5+
6+
object TestData {
7+
8+
val largeJsonFile: Path = Paths.get("../citylots/citylots.json")
9+
}

0 commit comments

Comments
 (0)