Skip to content

Commit c4d49f0

Browse files
committed
2.0.5
1 parent bbf518e commit c4d49f0

12 files changed

Lines changed: 63 additions & 45 deletions

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
# Changelog
22

3+
## 2.0.5 - 2019-04-
4+
5+
### Fixed
6+
7+
- Fix inaccuracy in deserializing some `float` values, e.g.,
8+
31.245270191439438 was parsed to 31.24527019143944. Serialization was
9+
unaffected.
10+
311
## 2.0.4 - 2019-04-02
412

513
### Changed
14+
615
- `orjson.dumps()` now serializes `datetime.datetime` objects without a
716
`tzinfo` rather than raising `JSONEncodeError`.
817

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "orjson"
3-
version = "2.0.4"
3+
version = "2.0.5"
44
authors = ["ijl <ijl@mailbox.org>"]
55
description = "Fast, correct Python JSON library"
66
edition = "2018"

README.md

Lines changed: 52 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ fastest Python library for JSON and has comprehensive unit, integration, and
55
interoperability tests.
66

77
Its serialization performance is 2x to 3x the nearest
8-
other library and 4.5x to 11.5x the standard library. Its deserialization
9-
performance is 0.95x to 1.1x the nearest other library and 1.2x to 3x
8+
other library and 4x to 12x the standard library. Its deserialization
9+
performance is 0.9x to 1.1x the nearest other library and 1.1x to 2x
1010
the standard library.
1111

1212
It differs in behavior from other Python JSON libraries in supporting
@@ -254,6 +254,12 @@ JSONEncodeError: Integer exceeds 53-bit max
254254
JSONEncodeError: Integer exceeds 53-bit max
255255
```
256256

257+
### float
258+
259+
orjson serializes and deserializes float values in a consistent way. The
260+
same behavior is observed in rapidjson, simplejson, and json. ujson is
261+
inaccurate in both serialization and deserialization.
262+
257263
### UTF-8
258264

259265
orjson raises an exception on invalid UTF-8. This is
@@ -329,84 +335,87 @@ format, containing floats and arrays, indented.
329335

330336
| Library | Median latency (milliseconds) | Operations per second | Relative (latency) |
331337
|------------|---------------------------------|-------------------------|----------------------|
332-
| orjson | 0.49 | 2038.2 | 1 |
333-
| ujson | 1.41 | 709.1 | 2.87 |
334-
| rapidjson | 1.57 | 636.4 | 3.2 |
335-
| simplejson | 2.69 | 370.5 | 5.49 |
336-
| json | 2.6 | 384.6 | 5.3 |
338+
| orjson | 0.54 | 1854.5 | 1 |
339+
| ujson | 1.47 | 678.3 | 2.73 |
340+
| rapidjson | 1.58 | 634 | 2.92 |
341+
| simplejson | 2.7 | 369.3 | 5.01 |
342+
| json | 2.45 | 407.7 | 4.55 |
337343

338344
#### twitter.json deserialization
339345

340346
| Library | Median latency (milliseconds) | Operations per second | Relative (latency) |
341347
|------------|---------------------------------|-------------------------|----------------------|
342-
| orjson | 2.46 | 403.8 | 1 |
343-
| ujson | 2.27 | 443 | 0.92 |
344-
| rapidjson | 3.11 | 320.1 | 1.26 |
345-
| simplejson | 2.48 | 401.9 | 1.01 |
346-
| json | 2.85 | 350.8 | 1.16 |
348+
| orjson | 2.6 | 384.4 | 1 |
349+
| ujson | 2.33 | 427.2 | 0.89 |
350+
| rapidjson | 3.09 | 322 | 1.19 |
351+
| simplejson | 2.61 | 381.5 | 1 |
352+
| json | 2.91 | 342.1 | 1.12 |
347353

348354
#### github.json serialization
349355

350356
| Library | Median latency (milliseconds) | Operations per second | Relative (latency) |
351357
|------------|---------------------------------|-------------------------|----------------------|
352-
| orjson | 0.05 | 18670.2 | 1 |
353-
| ujson | 0.14 | 7136.1 | 2.61 |
354-
| rapidjson | 0.16 | 6384.5 | 2.92 |
355-
| simplejson | 0.31 | 3192.2 | 5.82 |
356-
| json | 0.27 | 3623 | 5.12 |
358+
| orjson | 0.06 | 16532.4 | 1 |
359+
| ujson | 0.14 | 6990.6 | 2.35 |
360+
| rapidjson | 0.16 | 6236.3 | 2.65 |
361+
| simplejson | 0.31 | 3234.9 | 5.1 |
362+
| json | 0.25 | 3943.4 | 4.19 |
357363

358364
#### github.json deserialization
359365

360366
| Library | Median latency (milliseconds) | Operations per second | Relative (latency) |
361367
|------------|---------------------------------|-------------------------|----------------------|
362-
| orjson | 0.2 | 4988.3 | 1 |
363-
| ujson | 0.22 | 4525.8 | 1.11 |
364-
| rapidjson | 0.27 | 3698.6 | 1.35 |
365-
| simplejson | 0.23 | 4371.5 | 1.14 |
366-
| json | 0.24 | 4114.8 | 1.21 |
368+
| orjson | 0.23 | 4395.8 | 1 |
369+
| ujson | 0.23 | 4431.2 | 0.99 |
370+
| rapidjson | 0.27 | 3746.8 | 1.18 |
371+
| simplejson | 0.22 | 4652.8 | 0.95 |
372+
| json | 0.25 | 3991.5 | 1.11 |
367373

368374
#### citm_catalog.json serialization
369375

370376
| Library | Median latency (milliseconds) | Operations per second | Relative (latency) |
371377
|------------|---------------------------------|-------------------------|----------------------|
372-
| orjson | 0.79 | 1261.8 | 1 |
373-
| ujson | 2.61 | 381.6 | 3.31 |
374-
| rapidjson | 2.48 | 402.4 | 3.14 |
375-
| simplejson | 9.93 | 100.7 | 12.59 |
376-
| json | 5.81 | 172 | 7.37 |
378+
| orjson | 0.81 | 1232 | 1 |
379+
| ujson | 2.78 | 359.1 | 3.43 |
380+
| rapidjson | 2.59 | 386 | 3.19 |
381+
| simplejson | 10.53 | 95.2 | 12.98 |
382+
| json | 5.41 | 184.7 | 6.67 |
377383

378384
#### citm_catalog.json deserialization
379385

380386
| Library | Median latency (milliseconds) | Operations per second | Relative (latency) |
381387
|------------|---------------------------------|-------------------------|----------------------|
382-
| orjson | 4.45 | 224.7 | 1 |
383-
| ujson | 4.35 | 229.8 | 0.98 |
384-
| rapidjson | 5.52 | 181.7 | 1.24 |
385-
| simplejson | 6.11 | 163.1 | 1.37 |
386-
| json | 6.02 | 165.6 | 1.35 |
388+
| orjson | 4.76 | 210.1 | 1 |
389+
| ujson | 4.39 | 228 | 0.92 |
390+
| rapidjson | 5.79 | 174.9 | 1.22 |
391+
| simplejson | 6.1 | 163.8 | 1.28 |
392+
| json | 6.03 | 165.7 | 1.27 |
387393

388394
#### canada.json serialization
389395

390396
| Library | Median latency (milliseconds) | Operations per second | Relative (latency) |
391397
|------------|---------------------------------|-------------------------|----------------------|
392-
| orjson | 4.21 | 237.7 | 1 |
393-
| ujson | 8.42 | 118.4 | 2 |
394-
| rapidjson | 43.17 | 23.2 | 10.27 |
395-
| simplejson | 62.6 | 16 | 14.89 |
396-
| json | 47.93 | 20.9 | 11.4 |
398+
| orjson | 3.95 | 252.1 | 1 |
399+
| ujson | | | |
400+
| rapidjson | 44.17 | 22.6 | 11.18 |
401+
| simplejson | 64.52 | 15.5 | 16.33 |
402+
| json | 47.01 | 21.3 | 11.9 |
397403

398404
#### canada.json deserialization
399405

400406
| Library | Median latency (milliseconds) | Operations per second | Relative (latency) |
401407
|------------|---------------------------------|-------------------------|----------------------|
402-
| orjson | 8.56 | 116.3 | 1 |
403-
| ujson | 8.24 | 121.5 | 0.96 |
404-
| rapidjson | 29.05 | 34.4 | 3.39 |
405-
| simplejson | 26.85 | 37 | 3.14 |
406-
| json | 27.45 | 36.4 | 3.21 |
408+
| orjson | 14.76 | 67.8 | 1 |
409+
| ujson | | | |
410+
| rapidjson | 29.01 | 34.5 | 1.97 |
411+
| simplejson | 26.75 | 37.4 | 1.81 |
412+
| json | 27.18 | 36.8 | 1.84 |
413+
407414

415+
If a row is blank, the library did not serialize and deserialize the fixture without
416+
modifying it, e.g., returning different values for floating point numbers.
408417

409-
This was measured using Python 3.7.2 on Linux with orjson 2.0.3, ujson 1.35,
418+
This was measured using Python 3.7.3 on Linux with orjson 2.0.5, ujson 1.35,
410419
python-rapidson 0.7.0, and simplejson 3.16.0.
411420

412421
The results can be reproduced using the `pybench` and `graph` scripts.

doc/canada_deserialization.png

-791 Bytes
Loading

doc/canada_serialization.png

319 Bytes
Loading
-753 Bytes
Loading

doc/citm_catalog_serialization.png

545 Bytes
Loading

doc/github_deserialization.png

-123 Bytes
Loading

doc/github_serialization.png

-139 Bytes
Loading

0 commit comments

Comments
 (0)