Skip to content

Commit

Permalink
Json benchmarks (#1337)
Browse files Browse the repository at this point in the history
* Introduce lightweight twitter-feed benchmark
* Introduce benchmark that does a basic comparison with Jackson mapper
* Introduce benchmark that stresses primitives parsing
* Introduce more macro benchmarks
  • Loading branch information
qwwdfsad authored Feb 12, 2021
1 parent 6a8dc86 commit f28e005
Show file tree
Hide file tree
Showing 15 changed files with 66,547 additions and 321 deletions.
7 changes: 7 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 4 additions & 15 deletions benchmark/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ apply plugin: "me.champeau.gradle.jmh"

sourceCompatibility = 1.8
targetCompatibility = 1.8
jmh.jmhVersion = 1.21
jmh.jmhVersion = 1.22

if (rootProject.ext.jvm_ir_enabled) {
kotlin.target.compilations.all {
Expand All @@ -20,26 +20,15 @@ jmhJar {
baseName 'benchmarks'
classifier = null
version = null
destinationDir = file("$rootDir")
}

dependencies {
annotationProcessor 'com.google.auto.value:auto-value:1.4.1'
annotationProcessor 'com.ryanharter.auto.value:auto-value-gson:0.4.6'

compileOnly 'com.google.auto.value:auto-value:1.4.1'
compileOnly 'com.ryanharter.auto.value:auto-value-gson:0.4.6'

compile "org.openjdk.jmh:jmh-core:1.22"
implementation 'com.google.guava:guava:24.1.1-jre'

compile 'com.squareup.okio:okio:1.13.0'
compile 'com.google.code.gson:gson:2.8.1'
compile 'com.esotericsoftware:kryo:4.0.0'

compile 'com.fasterxml.jackson.core:jackson-databind:2.12.1'
compile 'com.fasterxml.jackson.module:jackson-module-kotlin:2.12.1'
compile project(':kotlinx-serialization-core')
compile project(':kotlinx-serialization-json')
compile project(':kotlinx-serialization-protobuf')

// async profiler
compile group: 'pl.project13.scala', name: 'sbt-jmh-extras', version: '0.3.3'
}
25 changes: 0 additions & 25 deletions benchmark/src/jmh/kotlin/kotlinx/benchmarks/SampleBenchmark.kt

This file was deleted.

23 changes: 23 additions & 0 deletions benchmark/src/jmh/kotlin/kotlinx/benchmarks/json/CitmBenchmark.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package kotlinx.benchmarks.json

import kotlinx.benchmarks.model.*
import kotlinx.serialization.json.*
import org.openjdk.jmh.annotations.*
import java.util.concurrent.*

@Warmup(iterations = 7, time = 1)
@Measurement(iterations = 7, time = 1)
@BenchmarkMode(Mode.Throughput)
@OutputTimeUnit(TimeUnit.SECONDS)
@State(Scope.Benchmark)
@Fork(2)
open class CitmBenchmark {
/*
* For some reason Citm is kind of de-facto standard cross-language benchmark.
* Order of magnitude: 200 ops/sec
*/
private val citm = CitmBenchmark::class.java.getResource("/citm_catalog.json").readBytes().decodeToString()

@Benchmark
fun decodeCitm(): CitmCatalog = Json.decodeFromString(CitmCatalog.serializer(), citm)
}
281 changes: 0 additions & 281 deletions benchmark/src/jmh/kotlin/kotlinx/benchmarks/json/GeneratedBenchmark.kt

This file was deleted.

Loading

0 comments on commit f28e005

Please sign in to comment.