You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This module provides benchmarking tools to compare the performance of JSON5 serialization/deserialization against standard JSON using kotlinx.serialization.
4
+
5
+
## Running the Benchmark
6
+
7
+
To run the complete benchmark suite:
8
+
9
+
```bash
10
+
./gradlew :benchmark:run
11
+
```
12
+
13
+
This will:
14
+
1. Warm up the JVM
15
+
2. Run serialization and deserialization benchmarks for various data types
The benchmark tests the following data structures:
37
+
38
+
-**SimplePerson**: Basic data class with name, age, and boolean
39
+
-**ComplexPerson**: Complex nested object with address, phone numbers, skills, etc.
40
+
-**Company**: Large nested structure with employees and departments
41
+
-**NumberTypes**: Various numeric types (int, long, double, float, byte, short)
42
+
-**CollectionTypes**: Lists, maps, and nested collections
43
+
-**Lists**: Collections of 50-100 complex objects
44
+
45
+
## Configuration
46
+
47
+
You can modify the benchmark parameters in `BenchmarkRunner.kt`:
48
+
49
+
-`iterations`: Number of operations per test (default: 1000)
50
+
-`warmupIterations`: Number of warmup iterations (default: 100)
51
+
52
+
## Running Tests
53
+
54
+
To run the benchmark module tests:
55
+
56
+
```bash
57
+
./gradlew :benchmark:test
58
+
```
59
+
60
+
## Sample Results
61
+
62
+
Based on typical runs, JSON standard library generally performs 2-6x faster than JSON5 for both serialization and deserialization, with the performance gap being larger for more complex data structures.
0 commit comments