fastsimdjson 2.0.0__tar.gz → 2.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {fastsimdjson-2.0.0/src/fastsimdjson.egg-info → fastsimdjson-2.0.1}/PKG-INFO +99 -99
- {fastsimdjson-2.0.0 → fastsimdjson-2.0.1}/README.md +98 -98
- {fastsimdjson-2.0.0 → fastsimdjson-2.0.1}/pyproject.toml +1 -1
- {fastsimdjson-2.0.0 → fastsimdjson-2.0.1/src/fastsimdjson.egg-info}/PKG-INFO +99 -99
- {fastsimdjson-2.0.0 → fastsimdjson-2.0.1}/MANIFEST.in +0 -0
- {fastsimdjson-2.0.0 → fastsimdjson-2.0.1}/setup.cfg +0 -0
- {fastsimdjson-2.0.0 → fastsimdjson-2.0.1}/setup.py +0 -0
- {fastsimdjson-2.0.0 → fastsimdjson-2.0.1}/src/fastsimdjson.cpp +0 -0
- {fastsimdjson-2.0.0 → fastsimdjson-2.0.1}/src/fastsimdjson.egg-info/SOURCES.txt +0 -0
- {fastsimdjson-2.0.0 → fastsimdjson-2.0.1}/src/fastsimdjson.egg-info/dependency_links.txt +0 -0
- {fastsimdjson-2.0.0 → fastsimdjson-2.0.1}/src/fastsimdjson.egg-info/requires.txt +0 -0
- {fastsimdjson-2.0.0 → fastsimdjson-2.0.1}/src/fastsimdjson.egg-info/top_level.txt +0 -0
- {fastsimdjson-2.0.0 → fastsimdjson-2.0.1}/src/typed.h +0 -0
- {fastsimdjson-2.0.0 → fastsimdjson-2.0.1}/tests/conftest.py +0 -0
- {fastsimdjson-2.0.0 → fastsimdjson-2.0.1}/tests/test_arrow.py +0 -0
- {fastsimdjson-2.0.0 → fastsimdjson-2.0.1}/tests/test_dumps.py +0 -0
- {fastsimdjson-2.0.0 → fastsimdjson-2.0.1}/tests/test_files.py +0 -0
- {fastsimdjson-2.0.0 → fastsimdjson-2.0.1}/tests/test_lazy.py +0 -0
- {fastsimdjson-2.0.0 → fastsimdjson-2.0.1}/tests/test_loads.py +0 -0
- {fastsimdjson-2.0.0 → fastsimdjson-2.0.1}/tests/test_minify.py +0 -0
- {fastsimdjson-2.0.0 → fastsimdjson-2.0.1}/tests/test_msgpack.py +0 -0
- {fastsimdjson-2.0.0 → fastsimdjson-2.0.1}/tests/test_stream.py +0 -0
- {fastsimdjson-2.0.0 → fastsimdjson-2.0.1}/tests/test_typed.py +0 -0
- {fastsimdjson-2.0.0 → fastsimdjson-2.0.1}/vendor/simdjson.cpp +0 -0
- {fastsimdjson-2.0.0 → fastsimdjson-2.0.1}/vendor/simdjson.h +0 -0
- {fastsimdjson-2.0.0 → fastsimdjson-2.0.1}/vendor/simdjson_arrow-LICENSE +0 -0
- {fastsimdjson-2.0.0 → fastsimdjson-2.0.1}/vendor/simdjson_arrow.cpp +0 -0
- {fastsimdjson-2.0.0 → fastsimdjson-2.0.1}/vendor/simdjson_arrow.h +0 -0
- {fastsimdjson-2.0.0 → fastsimdjson-2.0.1}/vendor/simdjson_msgpack-LICENSE +0 -0
- {fastsimdjson-2.0.0 → fastsimdjson-2.0.1}/vendor/simdjson_msgpack.cpp +0 -0
- {fastsimdjson-2.0.0 → fastsimdjson-2.0.1}/vendor/simdjson_msgpack.h +0 -0
- {fastsimdjson-2.0.0 → fastsimdjson-2.0.1}/vendor/simdutf.cpp +0 -0
- {fastsimdjson-2.0.0 → fastsimdjson-2.0.1}/vendor/simdutf.h +0 -0
- {fastsimdjson-2.0.0 → fastsimdjson-2.0.1}/vendor/simdutf_c.h +0 -0
- {fastsimdjson-2.0.0 → fastsimdjson-2.0.1}/vendor/zmij-LICENSE +0 -0
- {fastsimdjson-2.0.0 → fastsimdjson-2.0.1}/vendor/zmij.h +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fastsimdjson
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.1
|
|
4
4
|
Summary: Fast JSON parsing for Python, built on simdjson
|
|
5
5
|
Author-email: Daniel Lemire <daniel@lemire.me>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -45,7 +45,7 @@ Requires-Dist: ormsgpack; extra == "bench"
|
|
|
45
45
|
Fast JSON for Python, built on [simdjson](https://github.com/simdjson/simdjson),
|
|
46
46
|
the parser that reads JSON at gigabytes per second. fastsimdjson is a drop-in
|
|
47
47
|
replacement for the `json` module (`loads`, `load`, `dumps`, `dump`) that
|
|
48
|
-
gives the same results 3.5 to 4.
|
|
48
|
+
gives the same results 3.5 to 4.3 times faster, and it goes further: lazy
|
|
49
49
|
parsing, streams of documents on many threads, Apache Arrow tables and
|
|
50
50
|
MessagePack, in one package with no dependencies.
|
|
51
51
|
|
|
@@ -55,7 +55,7 @@ fastsimdjson is often two to four times faster than the alternatives:
|
|
|
55
55
|
|
|
56
56
|
<picture>
|
|
57
57
|
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_summary_dark.png">
|
|
58
|
-
<img src="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_summary.png" width="80%" alt="fastsimdjson against the competition, speed on one core relative to a fast alternative: Python objects to JSON str, 4.
|
|
58
|
+
<img src="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_summary.png" width="80%" alt="fastsimdjson against the competition, speed on one core relative to a fast alternative: Python objects to JSON str, 4.3 times json.dumps; MessagePack to JSON, 4.2 times ormsgpack with orjson; JSON to MessagePack, 3.6 times orjson with ormsgpack; NDJSON to Arrow, 3.6 times polars; Arrow to NDJSON, 2.4 times polars; a few fields of a document, 2.2 times msgspec; JSON to Python objects, 1.3 times orjson">
|
|
59
59
|
</picture>
|
|
60
60
|
|
|
61
61
|
Against the standard `json` module, `loads` is 3.5 times faster and `parse`
|
|
@@ -66,16 +66,16 @@ Against the standard `json` module, `loads` is 3.5 times faster and `parse`
|
|
|
66
66
|
same `str` as `json.dumps`, character for character, and `dumpb` the same
|
|
67
67
|
bytes as `orjson.dumps`. Switching changes the speed, not the output.
|
|
68
68
|
* **Typed.** `loads(data, type=T)` builds dataclasses, TypedDicts and
|
|
69
|
-
other typed values straight from the parser, with the types checked: 1.
|
|
70
|
-
to 2.1 times as fast as msgspec, 3.9 to 5.
|
|
69
|
+
other typed values straight from the parser, with the types checked: 1.6
|
|
70
|
+
to 2.1 times as fast as msgspec, 3.9 to 5.2 times as fast as pydantic.
|
|
71
71
|
* **Only what you need.** `parse` gives lazy views and builds only the
|
|
72
72
|
values you read; `fields=` extracts only some fields from each document of
|
|
73
73
|
a stream.
|
|
74
74
|
* **Many threads.** On free-threaded Python, streams of documents (NDJSON,
|
|
75
|
-
JSON Lines) are read and written on many threads: up to
|
|
75
|
+
JSON Lines) are read and written on many threads: up to 21 GB/s on 64
|
|
76
76
|
cores. Arrow and MessagePack conversions release the GIL and use many
|
|
77
77
|
threads on any Python: on 32 cores, `loads_arrow` reads NDJSON into Arrow
|
|
78
|
-
at up to
|
|
78
|
+
at up to 28.6 GB/s, 2.3 to 2.8 times as fast as pyarrow.
|
|
79
79
|
* **Arrow without pyarrow.** `loads_arrow` and `dumpb_arrow` convert NDJSON
|
|
80
80
|
to Arrow tables and back, for pyarrow, polars or DuckDB, without a copy.
|
|
81
81
|
* **MessagePack without Python objects.** `json_to_msgpack` and
|
|
@@ -84,7 +84,7 @@ Against the standard `json` module, `loads` is 3.5 times faster and `parse`
|
|
|
84
84
|
and returns `bytes`, without building Python objects.
|
|
85
85
|
* **Everywhere.** No dependencies; wheels for Linux (x64 and ARM), macOS
|
|
86
86
|
(Intel and Apple silicon) and Windows, Python 3.10 to 3.15, including
|
|
87
|
-
free-threaded Python.
|
|
87
|
+
free-threaded Python, and for Pyodide (WebAssembly).
|
|
88
88
|
|
|
89
89
|
## Installation
|
|
90
90
|
|
|
@@ -170,12 +170,12 @@ doc["search_metadata"].as_dict() # convert a subtree, like loads
|
|
|
170
170
|
|
|
171
171
|
`loads(data, type=T)` returns the document as an instance of `T`, checked
|
|
172
172
|
on the way. It builds dataclasses straight from the simdjson tape, without
|
|
173
|
-
an intermediate dict, and is 1.
|
|
173
|
+
an intermediate dict, and is 1.6 to 2.1 times as fast as msgspec on one core
|
|
174
174
|
(see [Typed decoding](#typed-decoding)).
|
|
175
175
|
|
|
176
176
|
<picture>
|
|
177
177
|
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_typed_dark.png">
|
|
178
|
-
<img src="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_typed.png" width="80%" alt="JSON to dataclasses on one core, GB/s. twitter.json, a few fields: fastsimdjson 2.
|
|
178
|
+
<img src="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_typed.png" width="80%" alt="JSON to dataclasses on one core, GB/s. twitter.json, a few fields: fastsimdjson 2.59, msgspec Struct 1.53, msgspec dataclasses 1.43, pydantic 0.66, orjson with cattrs 0.57. citm_catalog.json typed in full: fastsimdjson 1.00, msgspec Struct 0.64, msgspec dataclasses 0.47, pydantic 0.19, orjson with cattrs 0.19. GH Archive NDJSON, 6 fields: fastsimdjson 2.05, msgspec Struct 1.29, msgspec dataclasses 1.16, pydantic 0.52, orjson with cattrs 0.42">
|
|
179
179
|
</picture>
|
|
180
180
|
|
|
181
181
|
```python
|
|
@@ -472,10 +472,10 @@ by `json`. The whole documents are parsed (and validated) with the other
|
|
|
472
472
|
formats, and when a pointer is `""` or leads into the value of another
|
|
473
473
|
pointer (`["/a", "/a/b"]`).
|
|
474
474
|
|
|
475
|
-
On 7.6 GB of GitHub events, `map_many` with three fields ran at
|
|
475
|
+
On 7.6 GB of GitHub events, `map_many` with three fields ran at 3.0 GB/s on
|
|
476
476
|
one core of an Intel Xeon Gold 6548N, against 1.8 GB/s with lazy views
|
|
477
477
|
(`lazy=True`). With 64 threads (free-threaded Python 3.14.10t), it ran at
|
|
478
|
-
|
|
478
|
+
113 GB/s (lazy views: 81 GB/s).
|
|
479
479
|
|
|
480
480
|
### Arrow: `loads_arrow`, `load_arrow_file` and `dumpb_arrow`
|
|
481
481
|
|
|
@@ -743,7 +743,7 @@ python bench_minify.py
|
|
|
743
743
|
|
|
744
744
|
Intel Xeon Gold 6548N (Emerald Rapids), one core unless stated otherwise,
|
|
745
745
|
Python 3.14.10 (free-threaded Python 3.14.10t for the streams on several
|
|
746
|
-
threads), fastsimdjson
|
|
746
|
+
threads), fastsimdjson 2.0.1 (simdjson 5.1.1) built with GCC 16.2, the 22
|
|
747
747
|
files of [simdjson-data](https://github.com/simdjson/simdjson-data). The scripts are in
|
|
748
748
|
this repository and in
|
|
749
749
|
[the blog repository](https://github.com/lemire/Code-used-on-Daniel-Lemire-s-blog/tree/master/2026/09/pysimdjson).
|
|
@@ -763,23 +763,23 @@ geometric mean over the 22 files (higher is better).
|
|
|
763
763
|
| json (standard library) | 0.22 | 1.00× |
|
|
764
764
|
| simplejson 4.3.0 | 0.23 | 1.04× |
|
|
765
765
|
| python-rapidjson 1.26 | 0.24 | 1.08× |
|
|
766
|
-
| ujson 6.1.0 | 0.37 | 1.
|
|
766
|
+
| ujson 6.1.0 | 0.37 | 1.65× |
|
|
767
767
|
| cysimdjson 26.27 | 0.43 | 1.95× |
|
|
768
|
-
| pysimdjson 8.0.0 | 0.44 | 1.
|
|
769
|
-
| jiter 0.19.0 (no string cache) | 0.44 | 1.
|
|
768
|
+
| pysimdjson 8.0.0 | 0.44 | 1.99× |
|
|
769
|
+
| jiter 0.19.0 (no string cache) | 0.44 | 1.99× |
|
|
770
770
|
| msgspec 0.22.0 | 0.53 | 2.38× |
|
|
771
|
-
| jiter 0.19.0 (string cache, the default) | 0.54 | 2.
|
|
771
|
+
| jiter 0.19.0 (string cache, the default) | 0.54 | 2.44× |
|
|
772
772
|
| orjson 3.13.0 | 0.60 | 2.70× |
|
|
773
|
-
| **fastsimdjson `loads`** | **0.77** | **3.
|
|
773
|
+
| **fastsimdjson `loads`** | **0.77** | **3.47×** |
|
|
774
774
|
|
|
775
|
-
fastsimdjson is the fastest on 21 of the 22 files. orjson is
|
|
775
|
+
fastsimdjson is the fastest on 21 of the 22 files. orjson is 13% faster on
|
|
776
776
|
`numbers.json`, an array of floating-point numbers. On numbers, both spend
|
|
777
777
|
most of their time creating Python floats, which costs the same in both:
|
|
778
778
|
simdjson parses the numbers of these files faster than orjson's parser
|
|
779
779
|
(yyjson), but that is a small part of the total. Part of the gain comes from
|
|
780
780
|
pausing the garbage collector while the objects are built. fastsimdjson's
|
|
781
|
-
lead over orjson is 1.28× with the collector enabled and 1.
|
|
782
|
-
disabled (geometric means); without the collector, orjson is also
|
|
781
|
+
lead over orjson is 1.28× with the collector enabled and 1.17× with it
|
|
782
|
+
disabled (geometric means); without the collector, orjson is also 4 to 5%
|
|
783
783
|
faster on `canada.json` and `mesh.json`. yyjson 4.0.6 is left out: it
|
|
784
784
|
returns wrong strings for non-ASCII text. jiter (the parser of pydantic)
|
|
785
785
|
caches strings by default; turning the cache off (`cache_mode=False`) makes it
|
|
@@ -798,19 +798,19 @@ and the screen name of the 100 statuses of `twitter.json`:
|
|
|
798
798
|
|
|
799
799
|
<picture>
|
|
800
800
|
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_parse_dark.png">
|
|
801
|
-
<img src="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_parse.png" width="80%" alt="Reading part of twitter.json: fastsimdjson parse 156 µs, pysimdjson
|
|
801
|
+
<img src="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_parse.png" width="80%" alt="Reading part of twitter.json: fastsimdjson parse 156 µs, pysimdjson 170, cysimdjson 235, msgspec 336, fastsimdjson loads 843, orjson 981, jiter 1148, jiter without its string cache 1580, json 3977">
|
|
802
802
|
</picture>
|
|
803
803
|
|
|
804
804
|
| method | µs |
|
|
805
805
|
|---|---:|
|
|
806
806
|
| `json.loads` | 3977 |
|
|
807
|
-
| jiter (no string cache) |
|
|
808
|
-
| jiter (string cache) |
|
|
809
|
-
| orjson |
|
|
810
|
-
| fastsimdjson `loads` |
|
|
811
|
-
| msgspec (typed `Struct`) |
|
|
807
|
+
| jiter (no string cache) | 1580 |
|
|
808
|
+
| jiter (string cache) | 1148 |
|
|
809
|
+
| orjson | 981 |
|
|
810
|
+
| fastsimdjson `loads` | 843 |
|
|
811
|
+
| msgspec (typed `Struct`) | 336 |
|
|
812
812
|
| cysimdjson (lazy) | 235 |
|
|
813
|
-
| pysimdjson (lazy) |
|
|
813
|
+
| pysimdjson (lazy) | 170 |
|
|
814
814
|
| **fastsimdjson `parse`** | **156** |
|
|
815
815
|
|
|
816
816
|
Here `parse` is about 25 times faster than `json.loads` and 5.4 times faster
|
|
@@ -835,37 +835,37 @@ of 7 (`python bench_typed.py simdjson-data/jsonexamples gharchive.ndjson`):
|
|
|
835
835
|
|
|
836
836
|
<picture>
|
|
837
837
|
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_typed_dark.png">
|
|
838
|
-
<img src="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_typed.png" width="80%" alt="JSON to dataclasses on one core, GB/s. twitter.json, a few fields: fastsimdjson 2.
|
|
838
|
+
<img src="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_typed.png" width="80%" alt="JSON to dataclasses on one core, GB/s. twitter.json, a few fields: fastsimdjson 2.59, msgspec Struct 1.53, msgspec dataclasses 1.43, pydantic 0.66, orjson with cattrs 0.57. citm_catalog.json typed in full: fastsimdjson 1.00, msgspec Struct 0.64, msgspec dataclasses 0.47, pydantic 0.19, orjson with cattrs 0.19. GH Archive NDJSON, 6 fields: fastsimdjson 2.05, msgspec Struct 1.29, msgspec dataclasses 1.16, pydantic 0.52, orjson with cattrs 0.42">
|
|
839
839
|
</picture>
|
|
840
840
|
|
|
841
841
|
| | twitter | citm | gh |
|
|
842
842
|
|---|---:|---:|---:|
|
|
843
|
-
| **fastsimdjson `loads(type=)`** | **
|
|
844
|
-
| msgspec (Struct) |
|
|
845
|
-
| msgspec (dataclass) |
|
|
846
|
-
| pydantic 2.14 |
|
|
847
|
-
| orjson + cattrs |
|
|
848
|
-
| fastsimdjson `loads` (dicts, untyped) |
|
|
849
|
-
|
|
850
|
-
fastsimdjson is 1.
|
|
851
|
-
times as fast with the same dataclasses, and 3.9 to 5.
|
|
843
|
+
| **fastsimdjson `loads(type=)`** | **2594** | **996** | **2055** |
|
|
844
|
+
| msgspec (Struct) | 1530 | 636 | 1295 |
|
|
845
|
+
| msgspec (dataclass) | 1431 | 470 | 1158 |
|
|
846
|
+
| pydantic 2.14 | 662 | 192 | 517 |
|
|
847
|
+
| orjson + cattrs | 567 | 187 | 420 |
|
|
848
|
+
| fastsimdjson `loads` (dicts, untyped) | 932 | 1066 | 432 |
|
|
849
|
+
|
|
850
|
+
fastsimdjson is 1.6 to 1.7 times as fast as msgspec with Structs, 1.8 to 2.1
|
|
851
|
+
times as fast with the same dataclasses, and 3.9 to 5.2 times as fast as
|
|
852
852
|
pydantic. When most of the document is not needed (twitter, gh), typed
|
|
853
853
|
decoding is also 2.8 to 4.8 times as fast as building the dicts.
|
|
854
854
|
|
|
855
855
|
On free-threaded Python 3.14.10t, `loads_many(data, type=T, threads=N)` read
|
|
856
856
|
the 886 MB GH Archive file into dataclasses at 1.82 GB/s on one thread,
|
|
857
|
-
12.
|
|
857
|
+
12.6 GB/s on 8, 41.8 GB/s on 32 and 49.8 GB/s on 64.
|
|
858
858
|
|
|
859
859
|
### `dumps` against `json.dumps`
|
|
860
860
|
|
|
861
861
|
<picture>
|
|
862
862
|
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_dumps_dark.png">
|
|
863
|
-
<img src="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_dumps.png" width="80%" alt="Writing JSON as str: fastsimdjson dumps 4.
|
|
863
|
+
<img src="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_dumps.png" width="80%" alt="Writing JSON as str: fastsimdjson dumps 4.26 times faster than json.dumps">
|
|
864
864
|
</picture>
|
|
865
865
|
|
|
866
|
-
`dumps` returns exactly the `str` of `json.dumps` and is 4.
|
|
866
|
+
`dumps` returns exactly the `str` of `json.dumps` and is 4.3 times faster
|
|
867
867
|
(geometric mean over the 22 files; from 2.7 times on `citm_catalog.json` to
|
|
868
|
-
10.
|
|
868
|
+
10.4 times on `canada.json`).
|
|
869
869
|
|
|
870
870
|
### `dumpb` against orjson and msgspec
|
|
871
871
|
|
|
@@ -876,29 +876,29 @@ standard library, the same compact bytes come from
|
|
|
876
876
|
Each call encodes a fresh copy of the document (`bench_dumps.py`), so no
|
|
877
877
|
encoder gains from what it cached on the objects at a previous call. One
|
|
878
878
|
core of an Intel Xeon Gold 6548N, Python 3.14.10, GCC 16.2, fastsimdjson
|
|
879
|
-
|
|
879
|
+
2.0.1, orjson 3.13.0, msgspec 0.22.0. Microseconds:
|
|
880
880
|
|
|
881
881
|
<picture>
|
|
882
882
|
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_dumpb_dark.png">
|
|
883
|
-
<img src="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_dumpb.png" width="80%" alt="Writing JSON as bytes, speed relative to json.dumps(...).encode(): fastsimdjson dumpb
|
|
883
|
+
<img src="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_dumpb.png" width="80%" alt="Writing JSON as bytes, speed relative to json.dumps(...).encode(): fastsimdjson dumpb 8.03x, orjson 7.39x, msgspec 5.26x">
|
|
884
884
|
</picture>
|
|
885
885
|
|
|
886
886
|
| file | `json.dumps(...).encode()` | fastsimdjson `dumpb` | orjson | msgspec |
|
|
887
887
|
|---|---:|---:|---:|---:|
|
|
888
|
-
| twitter |
|
|
889
|
-
| citm_catalog |
|
|
890
|
-
| github_events |
|
|
891
|
-
| gsoc-2018 |
|
|
892
|
-
| update-center |
|
|
893
|
-
| canada |
|
|
894
|
-
| mesh |
|
|
895
|
-
| numbers |
|
|
896
|
-
|
|
897
|
-
Over the 22 files, `dumpb` is
|
|
898
|
-
|
|
888
|
+
| twitter | 1859 | 259 | 313 | 385 |
|
|
889
|
+
| citm_catalog | 3129 | 642 | 675 | 724 |
|
|
890
|
+
| github_events | 213 | 22 | 20 | 32 |
|
|
891
|
+
| gsoc-2018 | 12129 | 953 | 1273 | 2100 |
|
|
892
|
+
| update-center | 2679 | 328 | 320 | 532 |
|
|
893
|
+
| canada | 37695 | 2781 | 2478 | 3986 |
|
|
894
|
+
| mesh | 8962 | 875 | 1055 | 1405 |
|
|
895
|
+
| numbers | 2478 | 201 | 201 | 334 |
|
|
896
|
+
|
|
897
|
+
Over the 22 files, `dumpb` is 9% faster than orjson (geometric mean), from
|
|
898
|
+
11% slower on `canada.json` (mostly floating-point numbers) and up to 6%
|
|
899
899
|
slower on the smallest files (`twitter_api_response.json`,
|
|
900
|
-
`github_events.json`) to
|
|
901
|
-
mostly not ASCII, and
|
|
900
|
+
`github_events.json`) to 34% faster on `gsoc-2018.json`, whose strings are
|
|
901
|
+
mostly not ASCII, and on `semanticscholar-corpus.json`. `dumpb` is
|
|
902
902
|
1.5 times faster than msgspec (orjson 1.4 times) and 8 times faster than
|
|
903
903
|
`json`. The comparison was run on a processor
|
|
904
904
|
with AVX-512, which `dumpb` and orjson both use to escape strings; other x64
|
|
@@ -913,18 +913,18 @@ GCC 16.2, orjson 3.13.0 (`bench_minify.py`):
|
|
|
913
913
|
|
|
914
914
|
<picture>
|
|
915
915
|
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_minify_dark.png">
|
|
916
|
-
<img src="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_minify.png" width="80%" alt="Minifying JSON in Python: fastsimdjson minify 18.
|
|
916
|
+
<img src="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_minify.png" width="80%" alt="Minifying JSON in Python: fastsimdjson minify 18.58 GB/s, fastsimdjson dumpb(loads(s)) 0.54, orjson dumps(loads(s)) 0.44, json dumps(loads(s)) 0.11">
|
|
917
917
|
</picture>
|
|
918
918
|
|
|
919
919
|
| method | GB/s |
|
|
920
920
|
|---|---:|
|
|
921
|
-
| **fastsimdjson `minify`** | **18.
|
|
921
|
+
| **fastsimdjson `minify`** | **18.58** |
|
|
922
922
|
| `loads` + `dumpb` | 0.54 |
|
|
923
923
|
| orjson `loads` + `dumps` | 0.44 |
|
|
924
924
|
| `json.loads` + `json.dumps` | 0.11 |
|
|
925
925
|
|
|
926
|
-
Per file, `minify` runs from 15.
|
|
927
|
-
(`
|
|
926
|
+
Per file, `minify` runs from 15.7 GB/s (`repeat.json`) to 20.3 GB/s
|
|
927
|
+
(`numbers.json`).
|
|
928
928
|
|
|
929
929
|
### Writing NDJSON with `dumpb_many`
|
|
930
930
|
|
|
@@ -937,7 +937,7 @@ cores of one socket, 64 on both):
|
|
|
937
937
|
|
|
938
938
|
| threads | 1 | 8 | 32 | 64 |
|
|
939
939
|
|---|---:|---:|---:|---:|
|
|
940
|
-
| `dumpb_many(records, threads=N)` | 1.
|
|
940
|
+
| `dumpb_many(records, threads=N)` | 1.45 | 5.6 | 11.2 | 10.3 |
|
|
941
941
|
|
|
942
942
|
### NDJSON to Arrow and back
|
|
943
943
|
|
|
@@ -948,51 +948,51 @@ gives a `pyarrow.Table` (`pyarrow.table(fastsimdjson.loads_arrow(data,
|
|
|
948
948
|
schema, threads=N))`); the time includes the import into pyarrow. Writing
|
|
949
949
|
starts from that table: fastsimdjson `dumpb_arrow`, polars `write_ndjson` and
|
|
950
950
|
DuckDB `COPY ... TO` (on tmpfs). Python 3.14.10, pyarrow 26.0, polars 2.1,
|
|
951
|
-
DuckDB 2.0, fastsimdjson
|
|
951
|
+
DuckDB 2.0, fastsimdjson 2.0.1, Intel Xeon Gold 6548N (up to 32 threads on
|
|
952
952
|
the 32 cores of one socket; 64 threads on both sockets).
|
|
953
953
|
|
|
954
954
|
<picture>
|
|
955
955
|
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_arrow_read_1_dark.png">
|
|
956
|
-
<img src="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_arrow_read_1.png" width="80%" alt="Reading NDJSON into a pyarrow.Table on one thread: flat, fastsimdjson 0.
|
|
956
|
+
<img src="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_arrow_read_1.png" width="80%" alt="Reading NDJSON into a pyarrow.Table on one thread: flat, fastsimdjson 0.79 GB/s, pyarrow 0.18, polars 0.27; GH Archive, fastsimdjson 1.98, pyarrow 0.46, polars 0.54; flat with an inferred schema, fastsimdjson 0.78, pyarrow 0.18, polars 0.09">
|
|
957
957
|
</picture>
|
|
958
958
|
|
|
959
959
|
<picture>
|
|
960
960
|
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_arrow_read_32_dark.png">
|
|
961
|
-
<img src="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_arrow_read_32.png" width="80%" alt="Reading NDJSON into a pyarrow.Table on 32 threads: flat, fastsimdjson
|
|
961
|
+
<img src="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_arrow_read_32.png" width="80%" alt="Reading NDJSON into a pyarrow.Table on 32 threads: flat, fastsimdjson 14.7 GB/s, pyarrow 5.2, polars 4.0; GH Archive, fastsimdjson 28.6, pyarrow 12.3, polars 3.9; flat with an inferred schema, fastsimdjson 14.0, pyarrow 5.0, polars 0.12">
|
|
962
962
|
</picture>
|
|
963
963
|
|
|
964
964
|
<picture>
|
|
965
965
|
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_arrow_write_1_dark.png">
|
|
966
|
-
<img src="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_arrow_write_1.png" width="80%" alt="Writing a pyarrow.Table as NDJSON on one thread: flat, fastsimdjson 0.92 GB/s, polars 0.45, DuckDB 0.32; GH Archive, fastsimdjson 1.
|
|
966
|
+
<img src="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_arrow_write_1.png" width="80%" alt="Writing a pyarrow.Table as NDJSON on one thread: flat, fastsimdjson 0.92 GB/s, polars 0.45, DuckDB 0.32; GH Archive, fastsimdjson 1.07, polars 0.46, DuckDB 0.32">
|
|
967
967
|
</picture>
|
|
968
968
|
|
|
969
969
|
<picture>
|
|
970
970
|
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_arrow_write_32_dark.png">
|
|
971
|
-
<img src="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_arrow_write_32.png" width="80%" alt="Writing a pyarrow.Table as NDJSON on 32 threads: flat, fastsimdjson 9.
|
|
971
|
+
<img src="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_arrow_write_32.png" width="80%" alt="Writing a pyarrow.Table as NDJSON on 32 threads: flat, fastsimdjson 9.5 GB/s, polars 1.5, DuckDB 4.9; GH Archive, fastsimdjson 4.6, polars 1.0, DuckDB 1.2">
|
|
972
972
|
</picture>
|
|
973
973
|
|
|
974
974
|
All the numbers, in GB/s:
|
|
975
975
|
|
|
976
976
|
| | threads | 1 | 8 | 32 | 64 |
|
|
977
977
|
|---|---|---:|---:|---:|---:|
|
|
978
|
-
| flat, read | fastsimdjson `loads_arrow` | **0.
|
|
979
|
-
| | pyarrow `read_json` | 0.18 | 1.4 | 5.
|
|
980
|
-
| | polars `read_ndjson` | 0.27 |
|
|
981
|
-
| flat, read, inferring the schema | fastsimdjson `loads_arrow` | **0.
|
|
982
|
-
| | pyarrow `read_json` | 0.18 | 1.
|
|
978
|
+
| flat, read | fastsimdjson `loads_arrow` | **0.79** | **5.7** | **14.7** | **17.5** |
|
|
979
|
+
| | pyarrow `read_json` | 0.18 | 1.4 | 5.2 | 7.6 |
|
|
980
|
+
| | polars `read_ndjson` | 0.27 | 1.9 | 4.0 | 3.1 |
|
|
981
|
+
| flat, read, inferring the schema | fastsimdjson `loads_arrow` | **0.78** | **5.6** | **14.0** | **12.6** |
|
|
982
|
+
| | pyarrow `read_json` | 0.18 | 1.3 | 5.0 | 6.6 |
|
|
983
983
|
| | polars `read_ndjson` | 0.09 | 0.12 | 0.12 | 0.12 |
|
|
984
|
-
| GH Archive, read | fastsimdjson `loads_arrow` | **1.
|
|
985
|
-
| | pyarrow `read_json` | 0.46 | 3.5 | 12.
|
|
986
|
-
| | polars `read_ndjson` | 0.54 | 3.5 |
|
|
987
|
-
| flat, write | fastsimdjson `dumpb_arrow` | **0.92** | **3.
|
|
988
|
-
| | polars | 0.45 | 1.1 | 1.
|
|
989
|
-
| | DuckDB | 0.32 | 2.3 | 4.
|
|
990
|
-
| GH Archive, write | fastsimdjson `dumpb_arrow` | **1.
|
|
991
|
-
| | polars | 0.46 | 0.
|
|
992
|
-
| | DuckDB | 0.32 | 1.
|
|
993
|
-
|
|
994
|
-
`load_arrow_file` on the same files, from the page cache, reads at 0.
|
|
995
|
-
1.5 GB/s on one thread, 9.1 and
|
|
984
|
+
| GH Archive, read | fastsimdjson `loads_arrow` | **1.98** | **12.6** | **28.6** | **24.5** |
|
|
985
|
+
| | pyarrow `read_json` | 0.46 | 3.5 | 12.3 | 14.2 |
|
|
986
|
+
| | polars `read_ndjson` | 0.54 | 3.5 | 3.9 | 3.0 |
|
|
987
|
+
| flat, write | fastsimdjson `dumpb_arrow` | **0.92** | **3.6** | **9.5** | **11.3** |
|
|
988
|
+
| | polars | 0.45 | 1.1 | 1.5 | 1.4 |
|
|
989
|
+
| | DuckDB | 0.32 | 2.3 | 4.9 | 3.6 |
|
|
990
|
+
| GH Archive, write | fastsimdjson `dumpb_arrow` | **1.07** | **3.0** | **4.6** | **4.3** |
|
|
991
|
+
| | polars | 0.46 | 0.51 | 1.0 | 0.64 |
|
|
992
|
+
| | DuckDB | 0.32 | 1.2 | 1.2 | 0.99 |
|
|
993
|
+
|
|
994
|
+
`load_arrow_file` on the same files, from the page cache, reads at 0.70 and
|
|
995
|
+
1.5 GB/s on one thread, 9.1 and 12.6 GB/s on 32 threads. The benchmark is
|
|
996
996
|
`THREADS=N python bench_arrow.py flat.ndjson:flat gharchive.ndjson:gh
|
|
997
997
|
flat.ndjson:infer`; `path:infer` times any NDJSON file without a schema. The
|
|
998
998
|
flat file comes from
|
|
@@ -1018,7 +1018,7 @@ Xeon Gold 6548N, one core.
|
|
|
1018
1018
|
|
|
1019
1019
|
<picture>
|
|
1020
1020
|
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_msgpack_decode_dark.png">
|
|
1021
|
-
<img src="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_msgpack_decode.png" width="80%" alt="MessagePack to JSON in Python, geometric mean over the 22 files of simdjson-data: fastsimdjson msgpack_to_json 1.43 GB/s, ormsgpack with orjson 0.
|
|
1021
|
+
<img src="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_msgpack_decode.png" width="80%" alt="MessagePack to JSON in Python, geometric mean over the 22 files of simdjson-data: fastsimdjson msgpack_to_json 1.43 GB/s, ormsgpack with orjson 0.34, msgspec 0.32, msgpack with fastsimdjson dumpb 0.26, msgpack with orjson 0.26, msgpack with json 0.10">
|
|
1022
1022
|
</picture>
|
|
1023
1023
|
|
|
1024
1024
|
Streams: the 304,929 events of an hour of GH Archive (886 MB of NDJSON), with
|
|
@@ -1030,13 +1030,13 @@ sockets):
|
|
|
1030
1030
|
|
|
1031
1031
|
<picture>
|
|
1032
1032
|
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_msgpack_ndjson_dark.png">
|
|
1033
|
-
<img src="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_msgpack_ndjson.png" width="80%" alt="GH Archive NDJSON to MessagePack: fastsimdjson 22.
|
|
1033
|
+
<img src="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_msgpack_ndjson.png" width="80%" alt="GH Archive NDJSON to MessagePack: fastsimdjson 22.2 GB/s on 64 threads, 16.1 on 32, 8.7 on 8, 1.32 on one thread, orjson with ormsgpack 0.36 on one thread; MessagePack to NDJSON: fastsimdjson 6.0 GB/s on 8 threads, 1.51 on one thread, msgpack with orjson 0.25">
|
|
1034
1034
|
</picture>
|
|
1035
1035
|
|
|
1036
1036
|
| threads | 1 | 2 | 4 | 8 | 16 | 32 | 64 |
|
|
1037
1037
|
|---|---:|---:|---:|---:|---:|---:|---:|
|
|
1038
|
-
| NDJSON to MessagePack | 1.
|
|
1039
|
-
| MessagePack to NDJSON | 1.51 | 2.
|
|
1038
|
+
| NDJSON to MessagePack | 1.32 | 2.45 | 4.8 | 8.7 | 14.1 | 16.1 | 22.2 |
|
|
1039
|
+
| MessagePack to NDJSON | 1.51 | 2.27 | 4.4 | 6.0 | 6.0 | 6.0 | 5.9 |
|
|
1040
1040
|
|
|
1041
1041
|
MessagePack to NDJSON stops scaling at about eight threads: one thread must
|
|
1042
1042
|
find where the values end (MessagePack has no line ends) before the others
|
|
@@ -1052,20 +1052,20 @@ files; best of three runs:
|
|
|
1052
1052
|
|
|
1053
1053
|
<picture>
|
|
1054
1054
|
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_ndjson_dark.png">
|
|
1055
|
-
<img src="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_ndjson.png" width="80%" alt="Reading NDJSON: fastsimdjson parse_many 1.
|
|
1055
|
+
<img src="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_ndjson.png" width="80%" alt="Reading NDJSON: fastsimdjson parse_many 1.14 GB/s, loads_many 0.40, msgspec decode_lines 0.36, fastsimdjson loads per line 0.34, orjson per line 0.27, msgspec decode per line 0.27, jiter per line 0.24, jiter without its string cache per line 0.21, json per line 0.12">
|
|
1056
1056
|
</picture>
|
|
1057
1057
|
|
|
1058
1058
|
| method | ms | GB/s |
|
|
1059
1059
|
|---|---:|---:|
|
|
1060
|
-
| `json.loads` on each line |
|
|
1060
|
+
| `json.loads` on each line | 163 | 0.12 |
|
|
1061
1061
|
| jiter on each line (no string cache) | 94 | 0.21 |
|
|
1062
|
-
| jiter on each line (string cache) | 84 | 0.
|
|
1063
|
-
| msgspec `decode` on each line |
|
|
1064
|
-
| orjson on each line | 74 | 0.
|
|
1062
|
+
| jiter on each line (string cache) | 84 | 0.24 |
|
|
1063
|
+
| msgspec `decode` on each line | 74 | 0.27 |
|
|
1064
|
+
| orjson on each line | 74 | 0.27 |
|
|
1065
1065
|
| fastsimdjson `loads` on each line | 58 | 0.34 |
|
|
1066
1066
|
| msgspec `decode_lines` | 55 | 0.36 |
|
|
1067
1067
|
| fastsimdjson `loads_many` | 49 | 0.40 |
|
|
1068
|
-
| fastsimdjson `parse_many` (views only) | 17 | 1.
|
|
1068
|
+
| fastsimdjson `parse_many` (views only) | 17 | 1.14 |
|
|
1069
1069
|
|
|
1070
1070
|
`loads_many` is 13% faster than msgspec's `decode_lines`. `parse_many` only creates the views; reading values from them adds to
|
|
1071
1071
|
its time.
|
|
@@ -1078,12 +1078,12 @@ disabled (see below), Intel Xeon Gold 6548N (64 cores); GB/s:
|
|
|
1078
1078
|
|
|
1079
1079
|
| threads | 1 | 2 | 4 | 8 | 16 | 32 | 64 |
|
|
1080
1080
|
|---|---:|---:|---:|---:|---:|---:|---:|
|
|
1081
|
-
| `map_many(len, data, threads=N)` | 0.
|
|
1082
|
-
| `parse_many(data, threads=N)` | 1.
|
|
1083
|
-
| `loads_many(data, threads=N)` | 0.
|
|
1081
|
+
| `map_many(len, data, threads=N)` | 0.91 | 1.42 | 2.33 | 4.17 | 6.16 | 10.0 | 17.6 |
|
|
1082
|
+
| `parse_many(data, threads=N)` | 1.70 | 3.02 | 4.15 | 5.52 | 10.5 | 16.0 | **21.1** |
|
|
1083
|
+
| `loads_many(data, threads=N)` | 0.76 | 1.55 | 2.60 | 4.37 | 7.57 | 10.9 | 10.8 |
|
|
1084
1084
|
|
|
1085
|
-
`map_many` is 19 times faster on 64 threads than on one, and `parse_many`
|
|
1086
|
-
times. `loads_many` builds every document for the calling thread and is
|
|
1085
|
+
`map_many` is 19 times faster on 64 threads than on one, and `parse_many` 12
|
|
1086
|
+
times. `loads_many` builds every document for the calling thread and is 14
|
|
1087
1087
|
times faster. On 64 threads, these numbers vary by up to a third from one
|
|
1088
1088
|
run to the next. With the collector enabled,
|
|
1089
1089
|
Python collects after the call returns: it examines the millions of objects
|