Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jun 9, 2025

This PR extends the benchmark module to include a third JSON5 library (at.syntaxerror.json5:2.1.0) for comprehensive performance comparison across three different implementations:

  1. JSON5 (this project) - Uses kotlinx.serialization
  2. JSON (kotlinx.serialization) - Standard JSON baseline
  3. External-JSON5 (at.syntaxerror.json5:2.1.0) - External JSON5 library

Changes Made

  • Added dependency: at.syntaxerror.json5:2.1.0 to benchmark module
  • Extended SerializationBenchmark.kt: Added support for the external JSON5 library with proper serialization/deserialization benchmarking
  • Updated BenchmarkRunner.kt: Enhanced reporting to show all three libraries in both console output and generated reports
  • Updated tests: Modified BenchmarkTest to expect 6 results (3 libraries × 2 operations) instead of 4
  • Updated documentation: Enhanced benchmark README.md to reflect the three-way comparison

Sample Results

The benchmark now provides comprehensive performance analysis:

SimplePerson Serialization: JSON5=0.031ms, JSON=0.010ms, External-JSON5=0.012ms
ComplexPerson Serialization: JSON5=0.076ms, JSON=0.021ms, External-JSON5=0.028ms
Company Serialization: JSON5=0.240ms, JSON=0.030ms, External-JSON5=0.044ms

Performance Ranking: JSON (fastest) > External-JSON5 > JSON5 (this project)

Key Insights

  • kotlinx.serialization JSON remains the performance leader
  • External JSON5 library provides good balance of JSON5 features with reasonable performance
  • This project's JSON5 offers seamless kotlinx.serialization integration but at a performance cost

The benchmark results help users choose the right library based on their priorities: performance (JSON), JSON5 features with good performance (External-JSON5), or kotlinx.serialization integration (this project).

Fixes #33.


💡 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.

Copilot AI and others added 3 commits June 9, 2025 18:59
Co-authored-by: hossain-khan <99822+hossain-khan@users.noreply.github.com>
Co-authored-by: hossain-khan <99822+hossain-khan@users.noreply.github.com>
Co-authored-by: hossain-khan <99822+hossain-khan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add new JSON5 library for benchmark comparison. Add external JSON5 library for three-way benchmark comparison Jun 9, 2025
Copilot AI requested a review from hossain-khan June 9, 2025 19:13
Copilot finished work on behalf of hossain-khan June 9, 2025 19:13
@hossain-khan hossain-khan marked this pull request as ready for review June 9, 2025 19:28
@hossain-khan hossain-khan merged commit bf54fac into main Jun 9, 2025
2 checks passed
@hossain-khan hossain-khan deleted the copilot/fix-33 branch June 9, 2025 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add new JSON5 library for benchmark comparison.

2 participants