{"id":15978078,"url":"https://github.com/servb/kx-serialization-js-benchmark","last_synced_at":"2026-06-03T16:31:11.322Z","repository":{"id":130365595,"uuid":"279372995","full_name":"SerVB/kx-serialization-js-benchmark","owner":"SerVB","description":"Let's determine the best way of decoding JSON in K/JS!","archived":false,"fork":false,"pushed_at":"2020-07-13T17:52:52.000Z","size":220,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-23T04:19:43.040Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SerVB.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-07-13T17:47:46.000Z","updated_at":"2023-01-11T15:40:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"3bd50c67-6ebb-49dd-88b7-8f3f380fb289","html_url":"https://github.com/SerVB/kx-serialization-js-benchmark","commit_stats":{"total_commits":4,"total_committers":1,"mean_commits":4.0,"dds":0.0,"last_synced_commit":"c493dd3e0193d0a547e8c6a5f5702051100f1b61"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/SerVB/kx-serialization-js-benchmark","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SerVB%2Fkx-serialization-js-benchmark","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SerVB%2Fkx-serialization-js-benchmark/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SerVB%2Fkx-serialization-js-benchmark/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SerVB%2Fkx-serialization-js-benchmark/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SerVB","download_url":"https://codeload.github.com/SerVB/kx-serialization-js-benchmark/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SerVB%2Fkx-serialization-js-benchmark/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33874679,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-03T02:00:06.370Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-07T23:05:21.693Z","updated_at":"2026-06-03T16:31:11.303Z","avatar_url":"https://github.com/SerVB.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JSON decoding benchmarks for Kotlin/JS\nLet's determine the best way of decoding JSON in K/JS!\n\n## Data\nData classes from [Projector protocol](https://github.com/JetBrains/projector-client) are taken. A 200 KB JSON containing a snapshot of IntelliJ IDEA UI is used.\n\n## Competitors\n- `kotlinx.serialization.json.Json.parse` ([KotlinxJsonDecoder.kt](src/main/kotlin/decoder/KotlinxJsonDecoder.kt)).\n- `kotlinx.serialization.DynamicObjectParser.parse` ([KotlinxDopJsonDecoder.kt](src/main/kotlin/decoder/KotlinxDopJsonDecoder.kt)).\n- A manual parser which uses `when` to handle polymorphism ([ManualWhenJsonDecoder.kt](src/main/kotlin/decoder/ManualWhenJsonDecoder.kt)).\n- A manual parser which uses `mapOf` to handle polymorphism ([ManualKotlinMapJsonDecoder.kt](src/main/kotlin/decoder/ManualKotlinMapJsonDecoder.kt)).\n- A manual parser which uses `json` to handle polymorphism ([ManualJsMapJsonDecoder.kt](src/main/kotlin/decoder/ManualJsMapJsonDecoder.kt)).\n\n## Running\n### Online\n\u003chttps://servb.github.io/kx-serialization-js-benchmark/index.html\u003e.\n\n### Local\nBuild the project via `./gradlew browserProductionWebpack`. After it, open `build/distributions/index.html` in a browser.\n\nYou will see 5 buttons, each launches its test.\n\n## Results\nI use Chromium 78 on Linux Mint 19.3. CPU is i7-7700HQ.\n\nThere is an error every launch, but the main thing is clear: kx is much slower than manual decoding code:\n```\nkotlinx 200KB:           avg = 40.4 ms, (min, max) = (37.4 ms, 48.3 ms)\nkotlinx DOP 200KB:       avg = 36.9 ms, (min, max) = (35.8 ms, 39.0 ms)\nmanual when 200KB:       avg =  2.2 ms, (min, max) = ( 1.8 ms,  4.6 ms)\nmanual kotlin map 200KB: avg =  2.2 ms, (min, max) = ( 2.0 ms,  2.7 ms)\nmanual js map 200KB:     avg =  2.3 ms, (min, max) = ( 1.9 ms,  4.6 ms)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fservb%2Fkx-serialization-js-benchmark","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fservb%2Fkx-serialization-js-benchmark","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fservb%2Fkx-serialization-js-benchmark/lists"}