aboutsummaryrefslogtreecommitdiff
path: root/benchmarks/2.12/src/runtime.scala
diff options
context:
space:
mode:
authorJon Pretty <jon.pretty@propensive.com>2017-12-28 11:56:11 +0000
committerJon Pretty <jon.pretty@propensive.com>2017-12-28 11:56:11 +0000
commit89478a78f807d9bb28dcf6bdc60a16a391a3524c (patch)
treeb48b1dd51343ae0563082b2f38ec0f5252ce0e0b /benchmarks/2.12/src/runtime.scala
parentbd5f2dc411b1d63b9ee4dfec6476ba27d8410e2a (diff)
downloadmagnolia-virtual-params.tar.gz
magnolia-virtual-params.tar.bz2
magnolia-virtual-params.zip
Scala-fmt updatesvirtual-params
Diffstat (limited to 'benchmarks/2.12/src/runtime.scala')
-rw-r--r--benchmarks/2.12/src/runtime.scala66
1 files changed, 66 insertions, 0 deletions
diff --git a/benchmarks/2.12/src/runtime.scala b/benchmarks/2.12/src/runtime.scala
new file mode 100644
index 0000000..6a94163
--- /dev/null
+++ b/benchmarks/2.12/src/runtime.scala
@@ -0,0 +1,66 @@
+import adt._
+import cats._
+import derived._
+import cats.Show
+import cats.instances.all._
+import estrapade._
+import magnolia._
+
+object Gen extends TestApp {
+
+ val latin = Latin(
+ Letter("one", "two"),
+ Letter("three", "four"),
+ Letter("five", "six"),
+ Letter("seven", "eight"),
+ Letter("nine", "ten"),
+ Letter("eleven", "twelve"),
+ Letter("one", "two"),
+ Letter("three", "four"),
+ Letter("five", "six"),
+ Letter("seven", "eight"),
+ Letter("nine", "ten"),
+ Letter("eleven", "twelve"),
+ Letter("one", "two"),
+ Letter("three", "four"),
+ Letter("five", "six"),
+ Letter("seven", "eight"),
+ Letter("nine", "ten"),
+ Letter("eleven", "twelve"),
+ Letter("one", "two"),
+ Letter("three", "four"),
+ Letter("five", "six"),
+ Letter("seven", "eight")
+ )
+
+ def tests() = {
+ println("Warming up JVM")
+
+ var n = 0
+ var s: Any = null
+ while (n < 5000000) {
+ s = derive.show[Latin] //.show(latin)
+ s = magnolia.examples.Show.generic[Latin] //.show(latin)
+ n += 1
+ }
+
+ println("Warm")
+ test("Kittens") {
+ var n = 0
+ var s: Any = null
+ while (n < 1000000) {
+ s = derive.show[Latin] //.show(latin)
+ n += 1
+ }
+ }.returns()
+
+ test("Magnolia") {
+ var n = 0
+ var s: Any = null
+ while (n < 1000000) {
+ s = magnolia.examples.Show.generic[Latin] //.show(latin)
+ n += 1
+ }
+ }.returns()
+ }
+}