ScottPierce / kx-serialization-js-benchmark

Let's determine the best way of decoding JSON in K/JS!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JSON decoding benchmarks for Kotlin/JS

Let's determine the best way of decoding JSON in K/JS!

Data

Data classes from Projector protocol are taken. A 200 KB JSON containing a snapshot of IntelliJ IDEA UI is used.

Competitors

Running

Online

https://servb.github.io/kx-serialization-js-benchmark/index.html.

Local

Build the project via ./gradlew browserProductionWebpack. After it, open build/distributions/index.html in a browser.

You will see 5 buttons, each launches its test.

Results

I use Chromium 78 on Linux Mint 19.3. CPU is i7-7700HQ.

There is an error every launch, but the main thing is clear: kx is much slower than manual decoding code:

kotlinx 200KB:           avg = 40.4 ms, (min, max) = (37.4 ms, 48.3 ms)
kotlinx DOP 200KB:       avg = 36.9 ms, (min, max) = (35.8 ms, 39.0 ms)
manual when 200KB:       avg =  2.2 ms, (min, max) = ( 1.8 ms,  4.6 ms)
manual kotlin map 200KB: avg =  2.2 ms, (min, max) = ( 2.0 ms,  2.7 ms)
manual js map 200KB:     avg =  2.3 ms, (min, max) = ( 1.9 ms,  4.6 ms)

About

Let's determine the best way of decoding JSON in K/JS!


Languages

Language:Kotlin 99.9%Language:HTML 0.1%