Skip to content

Commit 65b6d1d

Browse files
committed
Update to scala meter 0.7 and scala-uri 0.4.12-SNAPSHOT
1 parent cecceaa commit 65b6d1d

File tree

3 files changed

+18
-54
lines changed

3 files changed

+18
-54
lines changed

build.sbt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ organization := "com.github.theon"
44

55
version := "0.0.1"
66

7-
scalaVersion := "2.10.3"
7+
scalaVersion := "2.11.7"
88

99
scalacOptions := Seq("-unchecked", "-deprecation", "-encoding", "utf8")
1010

1111
resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"
1212

1313
libraryDependencies ++= Seq(
14-
"com.netaporter" %% "scala-uri" % "0.4.2",
15-
"com.github.axel22" %% "scalameter" % "0.4"
14+
"com.netaporter" %% "scala-uri" % "0.4.12-SNAPSHOT",
15+
"com.storm-enroute" %% "scalameter" % "0.7"
1616
)
1717

1818
testFrameworks += new TestFramework("org.scalameter.ScalaMeterFramework")
1919

20-
logBuffered := false
20+
logBuffered := false

src/test/scala/com/netaporter/uri/ParsingBenchmark.scala

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,14 @@
11
package com.netaporter.uri
22

3-
import org.scalameter._
4-
import org.scalameter.execution.LocalExecutor
3+
import org.scalameter.api._
54
import util.Random
65
import com.netaporter.uri.Uri._
7-
import org.scalameter.reporting.{LoggingReporter, RegressionReporter, HtmlReporter}
8-
import org.scalameter.Executor.Measurer
9-
import org.scalameter.persistence.SerializationPersistor
106

117
/**
128
* Date: 14/04/2013
139
* Time: 16:46
1410
*/
15-
object ParsingBenchmark extends PerformanceTest {
16-
17-
lazy val executor = LocalExecutor(
18-
Executor.Warmer.Default(),
19-
Aggregator.complete(Aggregator.average),
20-
new Measurer.IgnoringGC
21-
)
22-
23-
lazy val reporter = Reporter.Composite(
24-
new RegressionReporter(
25-
RegressionReporter.Tester.Accepter(),
26-
RegressionReporter.Historian.ExponentialBackoff()
27-
),
28-
new LoggingReporter,
29-
HtmlReporter(embedDsv = true)
30-
)
31-
lazy val persistor = new SerializationPersistor
11+
object ParsingBenchmark extends Bench.OfflineReport {
3212

3313
val lengths = Gen.range("String Length")(1, 2000, 200)
3414
val testData = lengths.map(i => Random.alphanumeric.take(i).mkString)
@@ -44,7 +24,7 @@ object ParsingBenchmark extends PerformanceTest {
4424
"http://example.com?" + (1 until data).map(i => s"key$i=val$i").mkString("&")
4525
)
4626

47-
performance of "Uri-Parsing" config (api.exec.benchRuns -> 36, api.exec.maxWarmupRuns -> 10) in {
27+
performance of "Uri-Parsing" config (exec.benchRuns -> 36, exec.maxWarmupRuns -> 10) in {
4828

4929
measure method "path-length" in {
5030
using(testLongPaths) in {
@@ -77,3 +57,4 @@ object ParsingBenchmark extends PerformanceTest {
7757
}
7858
}
7959
}
60+
Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,34 @@
11
package com.netaporter.uri
22

3-
import org.scalameter._
4-
import org.scalameter.execution.LocalExecutor
5-
import org.scalameter.Executor.Measurer
6-
import org.scalameter.reporting.{RegressionReporter, HtmlReporter}
7-
import util.Random
8-
import org.scalameter.persistence.SerializationPersistor
3+
import org.scalameter.Measurer
4+
import org.scalameter.api._
5+
6+
import scala.util.Random
97

108
/**
119
* Date: 14/04/2013
1210
* Time: 18:29
1311
*/
14-
object RenderingBenchmark extends PerformanceTest {
15-
16-
lazy val executor = LocalExecutor(
17-
Executor.Warmer.Default(),
18-
Aggregator.complete(Aggregator.average),
19-
new Measurer.IgnoringGC
20-
)
21-
22-
lazy val reporter = Reporter.Composite(
23-
new RegressionReporter(
24-
RegressionReporter.Tester.Accepter(),
25-
RegressionReporter.Historian.ExponentialBackoff()
26-
),
27-
HtmlReporter(embedDsv = true)
28-
)
29-
lazy val persistor = new SerializationPersistor
12+
object RenderingBenchmark extends Bench.OfflineReport {
3013

3114
val lengths = Gen.range("String Length")(1, 20000, 2000)
3215
val testData = lengths.map(i => Random.alphanumeric.take(i).mkString)
3316

3417
val testLongPaths = testData.map(data => Uri("/" + data))
3518
val testLongDomains = testData.map(data => Uri("http", data, ""))
36-
val testLongQueryKeys = testData.map(data => Uri(query = QueryString(Vector(data -> "value"))))
37-
val testLongQueryValues = testData.map(data => Uri(query = QueryString(Vector("key" -> data))))
19+
val testLongQueryKeys = testData.map(data => Uri(query = QueryString(Vector(data -> Some("value")))))
20+
val testLongQueryValues = testData.map(data => Uri(query = QueryString(Vector("key" -> Some(data)))))
3821

3922
val numQueryStrings = Gen.range("Num of Query String Pairs")(1, 2000, 200)
4023

4124
val testNumQueryString = numQueryStrings.map(data =>
4225
Uri(scheme = "http",
4326
host = "example.com",
44-
query = QueryString((1 until data).toVector.map(i => ("key" + i, "val" + i)))
27+
query = QueryString((1 until data).toVector.map(i => ("key" + i, Some("val" + i))))
4528
)
4629
)
4730

48-
performance of "Uri-Rendering" config (api.exec.benchRuns -> 36, api.exec.maxWarmupRuns -> 10) in {
31+
performance of "Uri-Rendering" config (exec.benchRuns -> 36, exec.maxWarmupRuns -> 10) in {
4932

5033
measure method "path-length" in {
5134
using(testLongPaths) in {
@@ -77,4 +60,4 @@ object RenderingBenchmark extends PerformanceTest {
7760
}
7861
}
7962
}
80-
}
63+
}

0 commit comments

Comments
 (0)