Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@jacobromero
Copy link

@jacobromero jacobromero commented Oct 13, 2025

reopening from #594 and #601 as they got marked as stale and closed.

Add option OPT_STRICT_FLOAT to fail when attempting to serialize invalid floating point numbers (NaN, Infinity, -Infinity), rather than converting to null.

This allows users to handle cases where the serialized JSON would be different when deserialzing.

Bench mark tests

After changes

Dataset Name Min Max Mean StdDev Median IQR Outliers OPS Rounds Iterations
canada.json serialization test_dumps[canada.json-orjson] 3.2847 (1.0) 3.5891 (1.0) 3.4808 (1.0) 0.1193 (1.0) 3.4880 (1.0) 0.1383 (1.0) 1;0 287.2912 (1.0) 5 1000
canada.json serialization test_dumps[canada.json-json] 53.6749 (16.34) 61.5021 (17.14) 57.5255 (16.53) 2.8387 (23.80) 57.0523 (16.36) 3.1694 (22.92) 2;0 17.3836 (0.06) 5 18
citm_catalog.json serialization test_dumps[citm_catalog.json-orjson] 457.1500 (1.0) 491.3666 (1.0) 471.9669 (1.0) 13.1761 (1.0) 468.3416 (1.0) 18.3300 (1.0) 2;0 2,118.7925 (1.0) 5 10000
citm_catalog.json serialization test_dumps[citm_catalog.json-json] 3,766.4378 (8.24) 4,176.7522 (8.50) 3,955.6568 (8.38) 157.7054 (11.97) 3,923.7981 (8.38) 227.0969 (12.39) 2;0 252.8025 (0.12) 5 1000
github.json serialization test_dumps[github.json-orjson] 20.5222 (1.0) 22.2400 (1.0) 21.3391 (1.0) 0.7803 (1.0) 21.5893 (1.0) 1.4006 (1.0) 3;0 46.8622 (1.0) 5 100000
github.json serialization test_dumps[github.json-json] 177.3991 (8.64) 196.5864 (8.84) 189.8231 (8.90) 9.0014 (11.54) 196.0418 (9.08) 14.5856 (10.41) 1;0 5.2681 (0.11) 5 10000
twitter.json serialization test_dumps[twitter.json-orjson] 233.2322 (1.0) 258.9844 (1.0) 246.1588 (1.0) 12.0674 (1.0) 248.5571 (1.0) 22.9553 (1.0) 3;0 4,062.4186 (1.0) 5 10000
twitter.json serialization test_dumps[twitter.json-json] 1,705.8133 (7.31) 1,987.6210 (7.67) 1,799.5415 (7.31) 116.5602 (9.66) 1,770.0864 (7.12) 160.5328 (6.99) 1;0 555.6971 (0.14) 5 1000

Benchmark against master branch

Dataset Name Min Max Mean StdDev Median IQR Outliers OPS Rounds Iterations
canada.json serialization test_dumps[canada.json-orjson] 3.1220 (1.0) 3.4250 (1.0) 3.2669 (1.0) 0.1189 (1.0) 3.2970 (1.0) 0.1748 (1.0) 2;0 306.1040 (1.0) 5 1000
canada.json serialization test_dumps[canada.json-json] 54.1017 (17.33) 65.4944 (19.12) 58.8816 (18.02) 4.7291 (39.76) 59.7720 (18.13) 7.3956 (42.30) 2;0 16.9832 (0.06) 5 19
citm_catalog.json serialization test_dumps[citm_catalog.json-orjson] 454.2471 (1.0) 488.6039 (1.0) 470.0407 (1.0) 15.6919 (1.0) 469.5506 (1.0) 29.4838 (1.0) 2;0 2,127.4755 (1.0) 5 10000
citm_catalog.json serialization test_dumps[citm_catalog.json-json] 3,785.1678 (8.33) 4,179.1181 (8.55) 3,958.8131 (8.42) 177.2010 (11.29) 3,882.1394 (8.27) 312.1638 (10.59) 1;0 252.6010 (0.12) 5 1000
github.json serialization test_dumps[github.json-orjson] 21.9955 (1.0) 25.1784 (1.0) 23.6283 (1.0) 1.3207 (1.0) 23.2247 (1.0) 2.1487 (1.0) 2;0 42.3221 (1.0) 5 100000
github.json serialization test_dumps[github.json-json] 181.5460 (8.25) 210.0416 (8.34) 192.5024 (8.15) 11.2146 (8.49) 190.3760 (8.20) 15.4046 (7.17) 1;0 5.1947 (0.12) 5 10000
twitter.json serialization test_dumps[twitter.json-orjson] 246.3341 (1.0) 268.1238 (1.0) 254.7371 (1.0) 9.1197 (1.0) 253.3927 (1.0) 14.5981 (1.0) 1;0 3,925.6163 (1.0) 5 10000
twitter.json serialization test_dumps[twitter.json-json] 1,692.2346 (6.87) 1,963.0872 (7.32) 1,823.2605 (7.16) 100.6003 (11.03) 1,822.0593 (7.19) 132.5100 (9.08) 2;0 548.4680 (0.14) 5 1000

@jacobromero
Copy link
Author

bump to avoid getting marked stale

@github-actions github-actions bot added the Stale label Oct 24, 2025
@jacobromero
Copy link
Author

bump again, we need this to be merged in to fully migrate to use orjson

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant