Conversation
Task 9: Add two new FsCheck property tests to JsonParserProperties.fs verifying that JsonValue roundtrips correctly through all three JsonSaveOptions variants (None/indented and CompactSpaceAfterComma were previously untested; only DisableFormatting was covered by the existing property test). Task 10: Add JsonStjBenchmarks.fs — a concrete prototype of 'Option 2' from #1671 (keep the JsonValue public API, use System.Text.Json as the parsing kernel). The StjConverter module converts JsonDocument → JsonValue and benchmarks it against the current hand-written parser on three real-world JSON files (GitHub, Twitter, WorldBank). No new NuGet dependencies — System.Text.Json is part of the net8.0 shared framework. Updates Program.fs to support 'stj' benchmark target. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
dsyme
approved these changes
Mar 13, 2026
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 is an automated pull request from Repo Assist, an AI assistant for this repository.
Task 9 — Testing Improvements: JSON property tests for all SaveOptions
Extends
JsonParserProperties.fswith two new FsCheck property tests that were previously missing:Parsing JsonValue formatted with None (indented) returns the same JsonValue— 500 randomJsonValuetrees serialized withJsonSaveOptions.None(pretty-printed/indented) and parsed back; verifies the formatted output is valid JSON that round-trips correctly.Parsing JsonValue formatted with CompactSpaceAfterComma returns the same JsonValue— same check forJsonSaveOptions.CompactSpaceAfterComma(introduced in A new FSharp.Data.JsonSaveOptions value needed #1482).The existing
DisableFormattingproperty test (1000 cases) is unchanged. All three save-option variants are now covered by property tests.Task 10 — Take the Repository Forward: STJ benchmark prototype for #1671
Adds
tests/FSharp.Data.Benchmarks/JsonStjBenchmarks.fs— a working prototype of "Option 2" from the #1671 discussion (keep theJsonValuepublic API, useSystem.Text.Jsonas the parsing kernel).The
StjConvertermodule demonstrates the conversion path:JsonStjBenchmarksbenchmarks this against the current hand-written parser on three real-world JSON files (GitHub issues, Twitter sample, WorldBank). Runningdotnet run -c Release -- stjwill give a direct comparison of:This gives concrete data for the #1671 discussion without requiring any source-code changes to the main library. The
StjConverterprototype lives entirely in the benchmarks project.No new NuGet dependencies —
System.Text.Jsonis part of thenet8.0shared framework (the benchmarks project already targetsnet8.0).Also updates
Program.fsto acceptstjas a command-line argument and includesJsonStjBenchmarksin the default "run all" path.Test Status
JsonParserPropertiestests pass (including the 2 new property tests)