summaryrefslogtreecommitdiff
path: root/benchmark
diff options
context:
space:
mode:
authorVsevolod Tolstopyatov <qwwdfsad@gmail.com>2021-03-12 12:12:24 +0300
committerGitHub <noreply@github.com>2021-03-12 12:12:24 +0300
commit628c973991c6e45f5b5f663d826e0f73ab0abde0 (patch)
tree1d4aef98b3104356de648e7833fb908fe4c3f676 /benchmark
parent333f9ffb6febfaf880c8dc73a650447543374dff (diff)
downloadkotlinx.serialization-628c973991c6e45f5b5f663d826e0f73ab0abde0.tar.gz
Rewrite and restructure JSON parser (#1343)
* Get rid of spontaneous lookahead * Spill fewer variables into object state * Optimize token and whitespaces reading * Separate fast and slow paths * Add optimistic key consumption optimization to leverage indexOf intrinsic * Parse numbers and booleans without allocations * Improve exception messages in few places * Optimize JsonReader further -- don't make conditional array lookups where they are not really necessary * Make consumeString inliner-friendly * Optimize strings handling * Replace handrolled char-array with StringBuilder, tweak it here and there * Always use optimistic path for strings * Properly handle slow-path from the middle of a string * Remove no longer used WriteMode fields * Rename JsonReader to JsonLExer and JsonParser to JsonTreeReader
Diffstat (limited to 'benchmark')
-rw-r--r--benchmark/src/jmh/kotlin/kotlinx/benchmarks/json/CoerceInputValuesBenchmark.kt2
-rw-r--r--benchmark/src/jmh/kotlin/kotlinx/benchmarks/json/PrimitiveValuesBenchmark.kt1
2 files changed, 0 insertions, 3 deletions
diff --git a/benchmark/src/jmh/kotlin/kotlinx/benchmarks/json/CoerceInputValuesBenchmark.kt b/benchmark/src/jmh/kotlin/kotlinx/benchmarks/json/CoerceInputValuesBenchmark.kt
index 8e37bd9c..d81509d4 100644
--- a/benchmark/src/jmh/kotlin/kotlinx/benchmarks/json/CoerceInputValuesBenchmark.kt
+++ b/benchmark/src/jmh/kotlin/kotlinx/benchmarks/json/CoerceInputValuesBenchmark.kt
@@ -16,8 +16,6 @@ import java.util.concurrent.*
@Fork(2)
open class CoerceInputValuesBenchmark {
- // Specific benchmark to isolate effect on #1156. Remove after release of 1.0.1
-
@Serializable
class Holder(
val i1: Int,
diff --git a/benchmark/src/jmh/kotlin/kotlinx/benchmarks/json/PrimitiveValuesBenchmark.kt b/benchmark/src/jmh/kotlin/kotlinx/benchmarks/json/PrimitiveValuesBenchmark.kt
index 07c7f449..9125a84f 100644
--- a/benchmark/src/jmh/kotlin/kotlinx/benchmarks/json/PrimitiveValuesBenchmark.kt
+++ b/benchmark/src/jmh/kotlin/kotlinx/benchmarks/json/PrimitiveValuesBenchmark.kt
@@ -59,4 +59,3 @@ open class PrimitiveValuesBenchmark {
@Benchmark
fun encodeLong(): LongHolder = Json.decodeFromString(LongHolder.serializer(), longValue)
}
-