Add benchmark module for comparing JSON5 vs JSON serialization performance #15
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.




This PR adds a comprehensive benchmarking module to compare the performance of JSON5 serialization/deserialization against standard JSON using kotlinx.serialization.
What's Added
New
benchmarkModulebenchmark/directory with complete Gradle module setuplibmodule and kotlinx.serializationBenchmark Features
Test Data Types
SimplePerson: Basic data class with name, age, booleanComplexPerson: Nested object with address, phone numbers, skills, metadataCompany: Large structure with employees and departmentsNumberTypes: Various numeric types (int, long, double, float, byte, short)CollectionTypes: Lists, maps, and nested collectionsGenerated Reports
Sample Results
Based on typical runs, standard JSON consistently outperforms JSON5:
Files Added
benchmark/build.gradle.kts- Module build configurationbenchmark/src/main/kotlin/.../BenchmarkRunner.kt- Main benchmark executionbenchmark/src/main/kotlin/.../SerializationBenchmark.kt- Core benchmarking logicbenchmark/src/main/kotlin/.../TestData.kt- Data models for testingbenchmark/src/main/kotlin/.../TestDataGenerator.kt- Test data creationbenchmark/src/test/kotlin/.../BenchmarkTest.kt- Unit testsbenchmark/README.md- Documentation and usage instructionsConfiguration Updates
settings.gradle.ktsto include benchmark module.gitignoreto exclude generated benchmark reportsThe benchmark provides valuable insights into JSON5 performance characteristics and can be used to track performance improvements over time.
Fixes #14.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.