fastsimdjson 1.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.
Files changed (36) hide show
  1. {fastsimdjson-1.0.0/src/fastsimdjson.egg-info → fastsimdjson-2.0.1}/PKG-INFO +152 -100
  2. {fastsimdjson-1.0.0 → fastsimdjson-2.0.1}/README.md +151 -99
  3. {fastsimdjson-1.0.0 → fastsimdjson-2.0.1}/pyproject.toml +15 -1
  4. {fastsimdjson-1.0.0 → fastsimdjson-2.0.1}/src/fastsimdjson.cpp +605 -33
  5. {fastsimdjson-1.0.0 → fastsimdjson-2.0.1/src/fastsimdjson.egg-info}/PKG-INFO +152 -100
  6. {fastsimdjson-1.0.0 → fastsimdjson-2.0.1}/src/fastsimdjson.egg-info/SOURCES.txt +1 -0
  7. fastsimdjson-2.0.1/tests/conftest.py +21 -0
  8. {fastsimdjson-1.0.0 → fastsimdjson-2.0.1}/tests/test_dumps.py +10 -2
  9. {fastsimdjson-1.0.0 → fastsimdjson-2.0.1}/tests/test_lazy.py +1 -0
  10. {fastsimdjson-1.0.0 → fastsimdjson-2.0.1}/tests/test_loads.py +5 -0
  11. {fastsimdjson-1.0.0 → fastsimdjson-2.0.1}/tests/test_msgpack.py +1 -0
  12. {fastsimdjson-1.0.0 → fastsimdjson-2.0.1}/tests/test_stream.py +209 -0
  13. {fastsimdjson-1.0.0 → fastsimdjson-2.0.1}/tests/test_typed.py +4 -1
  14. {fastsimdjson-1.0.0 → fastsimdjson-2.0.1}/MANIFEST.in +0 -0
  15. {fastsimdjson-1.0.0 → fastsimdjson-2.0.1}/setup.cfg +0 -0
  16. {fastsimdjson-1.0.0 → fastsimdjson-2.0.1}/setup.py +0 -0
  17. {fastsimdjson-1.0.0 → fastsimdjson-2.0.1}/src/fastsimdjson.egg-info/dependency_links.txt +0 -0
  18. {fastsimdjson-1.0.0 → fastsimdjson-2.0.1}/src/fastsimdjson.egg-info/requires.txt +0 -0
  19. {fastsimdjson-1.0.0 → fastsimdjson-2.0.1}/src/fastsimdjson.egg-info/top_level.txt +0 -0
  20. {fastsimdjson-1.0.0 → fastsimdjson-2.0.1}/src/typed.h +0 -0
  21. {fastsimdjson-1.0.0 → fastsimdjson-2.0.1}/tests/test_arrow.py +0 -0
  22. {fastsimdjson-1.0.0 → fastsimdjson-2.0.1}/tests/test_files.py +0 -0
  23. {fastsimdjson-1.0.0 → fastsimdjson-2.0.1}/tests/test_minify.py +0 -0
  24. {fastsimdjson-1.0.0 → fastsimdjson-2.0.1}/vendor/simdjson.cpp +0 -0
  25. {fastsimdjson-1.0.0 → fastsimdjson-2.0.1}/vendor/simdjson.h +0 -0
  26. {fastsimdjson-1.0.0 → fastsimdjson-2.0.1}/vendor/simdjson_arrow-LICENSE +0 -0
  27. {fastsimdjson-1.0.0 → fastsimdjson-2.0.1}/vendor/simdjson_arrow.cpp +0 -0
  28. {fastsimdjson-1.0.0 → fastsimdjson-2.0.1}/vendor/simdjson_arrow.h +0 -0
  29. {fastsimdjson-1.0.0 → fastsimdjson-2.0.1}/vendor/simdjson_msgpack-LICENSE +0 -0
  30. {fastsimdjson-1.0.0 → fastsimdjson-2.0.1}/vendor/simdjson_msgpack.cpp +0 -0
  31. {fastsimdjson-1.0.0 → fastsimdjson-2.0.1}/vendor/simdjson_msgpack.h +0 -0
  32. {fastsimdjson-1.0.0 → fastsimdjson-2.0.1}/vendor/simdutf.cpp +0 -0
  33. {fastsimdjson-1.0.0 → fastsimdjson-2.0.1}/vendor/simdutf.h +0 -0
  34. {fastsimdjson-1.0.0 → fastsimdjson-2.0.1}/vendor/simdutf_c.h +0 -0
  35. {fastsimdjson-1.0.0 → fastsimdjson-2.0.1}/vendor/zmij-LICENSE +0 -0
  36. {fastsimdjson-1.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: 1.0.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.2 times faster, and it goes further: lazy
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.2 times json.dumps; MessagePack to JSON, 4.1 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">
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.5
70
- to 2.1 times as fast as msgspec, 3.9 to 5.1 times as fast as pydantic.
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 20 GB/s on 64
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 27.5 GB/s, 2.3 to 2.9 times as fast as pyarrow.
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
 
@@ -103,6 +103,17 @@ uv pip install fastsimdjson # in a uv project: uv add fastsimdjson
103
103
  Wheels are available for Linux, macOS and Windows, for Python 3.10 to 3.15,
104
104
  including free-threaded Python 3.14 and 3.15.
105
105
 
106
+ Wheels are also available for Pyodide (WebAssembly, in the browser or in
107
+ Node), for Python 3.13 to 3.15:
108
+
109
+ ```python
110
+ import micropip
111
+ await micropip.install("fastsimdjson")
112
+ ```
113
+
114
+ Under Pyodide, Python cannot start threads: `threads=` runs on the calling
115
+ thread.
116
+
106
117
  ## Usage
107
118
 
108
119
  ### `loads`: the whole document
@@ -159,12 +170,12 @@ doc["search_metadata"].as_dict() # convert a subtree, like loads
159
170
 
160
171
  `loads(data, type=T)` returns the document as an instance of `T`, checked
161
172
  on the way. It builds dataclasses straight from the simdjson tape, without
162
- an intermediate dict, and is 1.5 to 2.1 times as fast as msgspec on one core
173
+ an intermediate dict, and is 1.6 to 2.1 times as fast as msgspec on one core
163
174
  (see [Typed decoding](#typed-decoding)).
164
175
 
165
176
  <picture>
166
177
  <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_typed_dark.png">
167
- <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.60, msgspec Struct 1.52, msgspec dataclasses 1.43, pydantic 0.66, orjson with cattrs 0.55. citm_catalog.json typed in full: fastsimdjson 0.98, msgspec Struct 0.63, msgspec dataclasses 0.47, pydantic 0.19, orjson with cattrs 0.19. GH Archive NDJSON, 6 fields: fastsimdjson 2.05, msgspec Struct 1.30, msgspec dataclasses 1.16, pydantic 0.51, orjson with cattrs 0.42">
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">
168
179
  </picture>
169
180
 
170
181
  ```python
@@ -352,6 +363,18 @@ separated:
352
363
  | `"comma"` | documents separated by commas: `{...}, {...}` (simdjson also accepts white space between them) |
353
364
  | `"array"` | the elements of one array: `[{...}, {...}]` |
354
365
 
366
+ To read a file without copying it, map it in memory:
367
+
368
+ ```python
369
+ import mmap
370
+ with open("log.ndjson", "rb") as f, mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_READ) as m:
371
+ names = fastsimdjson.map_many(fn, memoryview(m), threads=64)
372
+ ```
373
+
374
+ A `memoryview` of `bytes`, or of a file mapped with `mmap.ACCESS_READ` (as
375
+ here), is read in place, and the mapped file must not change meanwhile;
376
+ other buffers (a `bytearray`, a view of a writable mmap) are copied first.
377
+
355
378
  simdjson parses the input in batches (`batch_size`, 1 MB by default); a
356
379
  larger document is handled automatically. In every format, documents that
357
380
  simdjson rejects are handled as in `loads`: a document that `json` accepts is
@@ -397,6 +420,19 @@ document, and the Python objects of all of them, to the calling thread.
397
420
  With the GIL (the default build of Python), the calling thread does all the
398
421
  work: `threads` has no effect on speed.
399
422
 
423
+ With `drop_none=True`, `map_many` leaves out the results that are `None`:
424
+ when `fn` keeps only a few documents, the threads do not build a list
425
+ entry for each of the others, and the calling thread has fewer to collect.
426
+
427
+ ```python
428
+ def starred(event):
429
+ kind, repo = event
430
+ return repo if kind == "WatchEvent" else None
431
+
432
+ names = fastsimdjson.map_many(starred, data, threads=64, drop_none=True,
433
+ fields=["/type", "/repo/name"])
434
+ ```
435
+
400
436
  ### Only some fields: `fields=`
401
437
 
402
438
  When you need a few values from each document, `fields` extracts them
@@ -424,10 +460,22 @@ missing key, an index past the end, or a step into a scalar) gives
424
460
  As with `at_pointer`, a key that appears twice in an object refers to its
425
461
  first occurrence. `fields` cannot be combined with `lazy=True`.
426
462
 
427
- On 7.6 GB of GitHub events, `map_many` with three fields ran at 2.2 GB/s on
463
+ With the formats `"whitespace"` and `"lines"`, `fields` reads the documents
464
+ with simdjson's On-Demand API: the top level of each document, the keys on
465
+ the way to the pointers and the values found there are read and validated,
466
+ so a malformed or incomplete document is still an error. The values that no
467
+ pointer reaches are skipped without being checked, so an invalid value
468
+ elsewhere in a document (`{"a": 1, "b": tru}` with `fields="/a"`) goes
469
+ unnoticed. A value that is read is handled as without `fields`: an error
470
+ raises `JSONDecodeError`, and a document that only `json` accepts is decoded
471
+ by `json`. The whole documents are parsed (and validated) with the other
472
+ formats, and when a pointer is `""` or leads into the value of another
473
+ pointer (`["/a", "/a/b"]`).
474
+
475
+ On 7.6 GB of GitHub events, `map_many` with three fields ran at 3.0 GB/s on
428
476
  one core of an Intel Xeon Gold 6548N, against 1.8 GB/s with lazy views
429
477
  (`lazy=True`). With 64 threads (free-threaded Python 3.14.10t), it ran at
430
- 84 GB/s (lazy views: 76 GB/s).
478
+ 113 GB/s (lazy views: 81 GB/s).
431
479
 
432
480
  ### Arrow: `loads_arrow`, `load_arrow_file` and `dumpb_arrow`
433
481
 
@@ -571,7 +619,11 @@ could be changed by another thread while we read it, so it is copied first:
571
619
  always by `loads_many`, `parse_many` and `map_many` (the iterator outlives
572
620
  the call) and by `loads_arrow`, `json_to_msgpack` and `msgpack_to_json`
573
621
  (which release the GIL), and only on a free-threaded build by `loads` and
574
- `parse`. Likewise, on a free-threaded build, `dumps` and `dumpb` hold
622
+ `parse`. The exception: `loads_many`, `parse_many` and `map_many` read a
623
+ read-only, contiguous `memoryview` of `bytes`, or of a file mapped with
624
+ `mmap.ACCESS_READ`, in place (the file must not change meanwhile). Other
625
+ read-only views (`memoryview(bytearray).toreadonly()`, a read-only view of a
626
+ writable mmap) are copied, since what they show can still change. Likewise, on a free-threaded build, `dumps` and `dumpb` hold
575
627
  references to the items of the containers they serialize.
576
628
 
577
629
  ### `release`
@@ -691,7 +743,7 @@ python bench_minify.py
691
743
 
692
744
  Intel Xeon Gold 6548N (Emerald Rapids), one core unless stated otherwise,
693
745
  Python 3.14.10 (free-threaded Python 3.14.10t for the streams on several
694
- threads), fastsimdjson 1.0.0 (simdjson 5.1.1) built with GCC 16.2, the 22
746
+ threads), fastsimdjson 2.0.1 (simdjson 5.1.1) built with GCC 16.2, the 22
695
747
  files of [simdjson-data](https://github.com/simdjson/simdjson-data). The scripts are in
696
748
  this repository and in
697
749
  [the blog repository](https://github.com/lemire/Code-used-on-Daniel-Lemire-s-blog/tree/master/2026/09/pysimdjson).
@@ -711,23 +763,23 @@ geometric mean over the 22 files (higher is better).
711
763
  | json (standard library) | 0.22 | 1.00× |
712
764
  | simplejson 4.3.0 | 0.23 | 1.04× |
713
765
  | python-rapidjson 1.26 | 0.24 | 1.08× |
714
- | ujson 6.1.0 | 0.37 | 1.64× |
766
+ | ujson 6.1.0 | 0.37 | 1.65× |
715
767
  | cysimdjson 26.27 | 0.43 | 1.95× |
716
- | pysimdjson 8.0.0 | 0.44 | 1.97× |
717
- | jiter 0.19.0 (no string cache) | 0.44 | 1.98× |
768
+ | pysimdjson 8.0.0 | 0.44 | 1.99× |
769
+ | jiter 0.19.0 (no string cache) | 0.44 | 1.99× |
718
770
  | msgspec 0.22.0 | 0.53 | 2.38× |
719
- | jiter 0.19.0 (string cache, the default) | 0.54 | 2.43× |
771
+ | jiter 0.19.0 (string cache, the default) | 0.54 | 2.44× |
720
772
  | orjson 3.13.0 | 0.60 | 2.70× |
721
- | **fastsimdjson `loads`** | **0.77** | **3.46×** |
773
+ | **fastsimdjson `loads`** | **0.77** | **3.47×** |
722
774
 
723
- fastsimdjson is the fastest on 21 of the 22 files. orjson is 12% faster on
775
+ fastsimdjson is the fastest on 21 of the 22 files. orjson is 13% faster on
724
776
  `numbers.json`, an array of floating-point numbers. On numbers, both spend
725
777
  most of their time creating Python floats, which costs the same in both:
726
778
  simdjson parses the numbers of these files faster than orjson's parser
727
779
  (yyjson), but that is a small part of the total. Part of the gain comes from
728
780
  pausing the garbage collector while the objects are built. fastsimdjson's
729
- lead over orjson is 1.28× with the collector enabled and 1.18× with it
730
- disabled (geometric means); without the collector, orjson is also 3 to 4%
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%
731
783
  faster on `canada.json` and `mesh.json`. yyjson 4.0.6 is left out: it
732
784
  returns wrong strings for non-ASCII text. jiter (the parser of pydantic)
733
785
  caches strings by default; turning the cache off (`cache_mode=False`) makes it
@@ -746,19 +798,19 @@ and the screen name of the 100 statuses of `twitter.json`:
746
798
 
747
799
  <picture>
748
800
  <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_parse_dark.png">
749
- <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 169, cysimdjson 235, msgspec 337, fastsimdjson loads 844, orjson 971, jiter 1156, jiter without its string cache 1602, json 3977">
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">
750
802
  </picture>
751
803
 
752
804
  | method | µs |
753
805
  |---|---:|
754
806
  | `json.loads` | 3977 |
755
- | jiter (no string cache) | 1602 |
756
- | jiter (string cache) | 1156 |
757
- | orjson | 971 |
758
- | fastsimdjson `loads` | 844 |
759
- | msgspec (typed `Struct`) | 337 |
807
+ | jiter (no string cache) | 1580 |
808
+ | jiter (string cache) | 1148 |
809
+ | orjson | 981 |
810
+ | fastsimdjson `loads` | 843 |
811
+ | msgspec (typed `Struct`) | 336 |
760
812
  | cysimdjson (lazy) | 235 |
761
- | pysimdjson (lazy) | 169 |
813
+ | pysimdjson (lazy) | 170 |
762
814
  | **fastsimdjson `parse`** | **156** |
763
815
 
764
816
  Here `parse` is about 25 times faster than `json.loads` and 5.4 times faster
@@ -783,37 +835,37 @@ of 7 (`python bench_typed.py simdjson-data/jsonexamples gharchive.ndjson`):
783
835
 
784
836
  <picture>
785
837
  <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_typed_dark.png">
786
- <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.60, msgspec Struct 1.52, msgspec dataclasses 1.43, pydantic 0.66, orjson with cattrs 0.55. citm_catalog.json typed in full: fastsimdjson 0.98, msgspec Struct 0.63, msgspec dataclasses 0.47, pydantic 0.19, orjson with cattrs 0.19. GH Archive NDJSON, 6 fields: fastsimdjson 2.05, msgspec Struct 1.30, msgspec dataclasses 1.16, pydantic 0.51, orjson with cattrs 0.42">
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">
787
839
  </picture>
788
840
 
789
841
  | | twitter | citm | gh |
790
842
  |---|---:|---:|---:|
791
- | **fastsimdjson `loads(type=)`** | **2597** | **981** | **2055** |
792
- | msgspec (Struct) | 1520 | 632 | 1296 |
793
- | msgspec (dataclass) | 1428 | 467 | 1156 |
794
- | pydantic 2.14 | 659 | 192 | 514 |
795
- | orjson + cattrs | 553 | 187 | 420 |
796
- | fastsimdjson `loads` (dicts, untyped) | 933 | 1074 | 431 |
797
-
798
- fastsimdjson is 1.5 to 1.7 times as fast as msgspec with Structs, 1.8 to 2.1
799
- times as fast with the same dataclasses, and 3.9 to 5.1 times as fast as
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
800
852
  pydantic. When most of the document is not needed (twitter, gh), typed
801
853
  decoding is also 2.8 to 4.8 times as fast as building the dicts.
802
854
 
803
855
  On free-threaded Python 3.14.10t, `loads_many(data, type=T, threads=N)` read
804
856
  the 886 MB GH Archive file into dataclasses at 1.82 GB/s on one thread,
805
- 12.0 GB/s on 8 and 33.3 GB/s on 32.
857
+ 12.6 GB/s on 8, 41.8 GB/s on 32 and 49.8 GB/s on 64.
806
858
 
807
859
  ### `dumps` against `json.dumps`
808
860
 
809
861
  <picture>
810
862
  <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_dumps_dark.png">
811
- <img src="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_dumps.png" width="80%" alt="Writing JSON as str: fastsimdjson dumps 4.21 times faster than json.dumps">
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">
812
864
  </picture>
813
865
 
814
- `dumps` returns exactly the `str` of `json.dumps` and is 4.2 times faster
866
+ `dumps` returns exactly the `str` of `json.dumps` and is 4.3 times faster
815
867
  (geometric mean over the 22 files; from 2.7 times on `citm_catalog.json` to
816
- 10.5 times on `canada.json`).
868
+ 10.4 times on `canada.json`).
817
869
 
818
870
  ### `dumpb` against orjson and msgspec
819
871
 
@@ -824,29 +876,29 @@ standard library, the same compact bytes come from
824
876
  Each call encodes a fresh copy of the document (`bench_dumps.py`), so no
825
877
  encoder gains from what it cached on the objects at a previous call. One
826
878
  core of an Intel Xeon Gold 6548N, Python 3.14.10, GCC 16.2, fastsimdjson
827
- 1.0.0, orjson 3.13.0, msgspec 0.22.0. Microseconds:
879
+ 2.0.1, orjson 3.13.0, msgspec 0.22.0. Microseconds:
828
880
 
829
881
  <picture>
830
882
  <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_dumpb_dark.png">
831
- <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 7.95x, orjson 7.38x, msgspec 5.26x">
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">
832
884
  </picture>
833
885
 
834
886
  | file | `json.dumps(...).encode()` | fastsimdjson `dumpb` | orjson | msgspec |
835
887
  |---|---:|---:|---:|---:|
836
- | twitter | 1804 | 258 | 313 | 387 |
837
- | citm_catalog | 3114 | 651 | 666 | 716 |
838
- | github_events | 211 | 21 | 20 | 32 |
839
- | gsoc-2018 | 12153 | 956 | 1165 | 2095 |
840
- | update-center | 2647 | 309 | 298 | 514 |
841
- | canada | 37821 | 2743 | 2480 | 3978 |
842
- | mesh | 8903 | 876 | 1049 | 1401 |
843
- | numbers | 2473 | 201 | 204 | 332 |
844
-
845
- Over the 22 files, `dumpb` is 8% faster than orjson (geometric mean), from
846
- 10% slower on `canada.json` (mostly floating-point numbers) and up to 6%
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%
847
899
  slower on the smallest files (`twitter_api_response.json`,
848
- `github_events.json`) to 22% faster on `gsoc-2018.json`, whose strings are
849
- mostly not ASCII, and 35% faster on `semanticscholar-corpus.json`. `dumpb` is
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
850
902
  1.5 times faster than msgspec (orjson 1.4 times) and 8 times faster than
851
903
  `json`. The comparison was run on a processor
852
904
  with AVX-512, which `dumpb` and orjson both use to escape strings; other x64
@@ -861,18 +913,18 @@ GCC 16.2, orjson 3.13.0 (`bench_minify.py`):
861
913
 
862
914
  <picture>
863
915
  <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_minify_dark.png">
864
- <img src="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_minify.png" width="80%" alt="Minifying JSON in Python: fastsimdjson minify 18.64 GB/s, fastsimdjson dumpb(loads(s)) 0.54, orjson dumps(loads(s)) 0.44, json dumps(loads(s)) 0.11">
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">
865
917
  </picture>
866
918
 
867
919
  | method | GB/s |
868
920
  |---|---:|
869
- | **fastsimdjson `minify`** | **18.64** |
921
+ | **fastsimdjson `minify`** | **18.58** |
870
922
  | `loads` + `dumpb` | 0.54 |
871
923
  | orjson `loads` + `dumps` | 0.44 |
872
924
  | `json.loads` + `json.dumps` | 0.11 |
873
925
 
874
- Per file, `minify` runs from 15.4 GB/s (`canada.json`) to 20.7 GB/s
875
- (`apache_builds.json`).
926
+ Per file, `minify` runs from 15.7 GB/s (`repeat.json`) to 20.3 GB/s
927
+ (`numbers.json`).
876
928
 
877
929
  ### Writing NDJSON with `dumpb_many`
878
930
 
@@ -885,7 +937,7 @@ cores of one socket, 64 on both):
885
937
 
886
938
  | threads | 1 | 8 | 32 | 64 |
887
939
  |---|---:|---:|---:|---:|
888
- | `dumpb_many(records, threads=N)` | 1.48 | 5.6 | 11.6 | 10.5 |
940
+ | `dumpb_many(records, threads=N)` | 1.45 | 5.6 | 11.2 | 10.3 |
889
941
 
890
942
  ### NDJSON to Arrow and back
891
943
 
@@ -896,51 +948,51 @@ gives a `pyarrow.Table` (`pyarrow.table(fastsimdjson.loads_arrow(data,
896
948
  schema, threads=N))`); the time includes the import into pyarrow. Writing
897
949
  starts from that table: fastsimdjson `dumpb_arrow`, polars `write_ndjson` and
898
950
  DuckDB `COPY ... TO` (on tmpfs). Python 3.14.10, pyarrow 26.0, polars 2.1,
899
- DuckDB 2.0, fastsimdjson 1.0.0, Intel Xeon Gold 6548N (up to 32 threads on
951
+ DuckDB 2.0, fastsimdjson 2.0.1, Intel Xeon Gold 6548N (up to 32 threads on
900
952
  the 32 cores of one socket; 64 threads on both sockets).
901
953
 
902
954
  <picture>
903
955
  <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_arrow_read_1_dark.png">
904
- <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.76 GB/s, pyarrow 0.18, polars 0.27; GH Archive, fastsimdjson 1.96, pyarrow 0.46, polars 0.54; flat with an inferred schema, fastsimdjson 0.79, pyarrow 0.18, polars 0.09">
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">
905
957
  </picture>
906
958
 
907
959
  <picture>
908
960
  <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_arrow_read_32_dark.png">
909
- <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 15.0 GB/s, pyarrow 5.3, polars 4.3; GH Archive, fastsimdjson 27.5, pyarrow 12.1, polars 4.0; flat with an inferred schema, fastsimdjson 14.4, pyarrow 5.0, polars 0.12">
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">
910
962
  </picture>
911
963
 
912
964
  <picture>
913
965
  <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_arrow_write_1_dark.png">
914
- <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.08, polars 0.46, DuckDB 0.32">
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">
915
967
  </picture>
916
968
 
917
969
  <picture>
918
970
  <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_arrow_write_32_dark.png">
919
- <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.6 GB/s, polars 1.6, DuckDB 4.8; GH Archive, fastsimdjson 4.8, polars 0.86, DuckDB 1.1">
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">
920
972
  </picture>
921
973
 
922
974
  All the numbers, in GB/s:
923
975
 
924
976
  | | threads | 1 | 8 | 32 | 64 |
925
977
  |---|---|---:|---:|---:|---:|
926
- | flat, read | fastsimdjson `loads_arrow` | **0.76** | **5.7** | **15.0** | **18.0** |
927
- | | pyarrow `read_json` | 0.18 | 1.4 | 5.3 | 7.8 |
928
- | | polars `read_ndjson` | 0.27 | 2.0 | 4.3 | 3.1 |
929
- | flat, read, inferring the schema | fastsimdjson `loads_arrow` | **0.79** | **5.6** | **14.4** | **12.5** |
930
- | | pyarrow `read_json` | 0.18 | 1.4 | 5.0 | 6.8 |
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 |
931
983
  | | polars `read_ndjson` | 0.09 | 0.12 | 0.12 | 0.12 |
932
- | GH Archive, read | fastsimdjson `loads_arrow` | **1.96** | **12.9** | **27.5** | **24.3** |
933
- | | pyarrow `read_json` | 0.46 | 3.5 | 12.1 | 14.5 |
934
- | | polars `read_ndjson` | 0.54 | 3.5 | 4.0 | 3.1 |
935
- | flat, write | fastsimdjson `dumpb_arrow` | **0.92** | **3.7** | **9.6** | **12.1** |
936
- | | polars | 0.45 | 1.1 | 1.6 | 1.5 |
937
- | | DuckDB | 0.32 | 2.3 | 4.8 | 3.4 |
938
- | GH Archive, write | fastsimdjson `dumpb_arrow` | **1.08** | **3.0** | **4.8** | **4.2** |
939
- | | polars | 0.46 | 0.52 | 0.86 | 1.06 |
940
- | | DuckDB | 0.32 | 1.3 | 1.1 | 0.86 |
941
-
942
- `load_arrow_file` on the same files, from the page cache, reads at 0.69 and
943
- 1.5 GB/s on one thread, 9.1 and 13.0 GB/s on 32 threads. The benchmark is
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
944
996
  `THREADS=N python bench_arrow.py flat.ndjson:flat gharchive.ndjson:gh
945
997
  flat.ndjson:infer`; `path:infer` times any NDJSON file without a schema. The
946
998
  flat file comes from
@@ -966,7 +1018,7 @@ Xeon Gold 6548N, one core.
966
1018
 
967
1019
  <picture>
968
1020
  <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_msgpack_decode_dark.png">
969
- <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.35, msgspec 0.32, msgpack with fastsimdjson dumpb 0.26, msgpack with orjson 0.26, msgpack with json 0.10">
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">
970
1022
  </picture>
971
1023
 
972
1024
  Streams: the 304,929 events of an hour of GH Archive (886 MB of NDJSON), with
@@ -978,13 +1030,13 @@ sockets):
978
1030
 
979
1031
  <picture>
980
1032
  <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_msgpack_ndjson_dark.png">
981
- <img src="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_msgpack_ndjson.png" width="80%" alt="GH Archive NDJSON to MessagePack: fastsimdjson 22.7 GB/s on 64 threads, 16.0 on 32, 8.7 on 8, 1.31 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">
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">
982
1034
  </picture>
983
1035
 
984
1036
  | threads | 1 | 2 | 4 | 8 | 16 | 32 | 64 |
985
1037
  |---|---:|---:|---:|---:|---:|---:|---:|
986
- | NDJSON to MessagePack | 1.31 | 2.45 | 4.7 | 8.7 | 14.0 | 16.0 | 22.7 |
987
- | MessagePack to NDJSON | 1.51 | 2.26 | 4.4 | 6.0 | 6.0 | 6.0 | 5.9 |
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 |
988
1040
 
989
1041
  MessagePack to NDJSON stops scaling at about eight threads: one thread must
990
1042
  find where the values end (MessagePack has no line ends) before the others
@@ -1000,20 +1052,20 @@ files; best of three runs:
1000
1052
 
1001
1053
  <picture>
1002
1054
  <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_ndjson_dark.png">
1003
- <img src="https://raw.githubusercontent.com/simdjson/fastpysimdjson/main/doc/perf_ndjson.png" width="80%" alt="Reading NDJSON: fastsimdjson parse_many 1.13 GB/s, loads_many 0.40, msgspec decode_lines 0.36, fastsimdjson loads per line 0.34, orjson per line 0.26, msgspec decode per line 0.26, jiter per line 0.23, jiter without its string cache per line 0.21, json per line 0.12">
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">
1004
1056
  </picture>
1005
1057
 
1006
1058
  | method | ms | GB/s |
1007
1059
  |---|---:|---:|
1008
- | `json.loads` on each line | 164 | 0.12 |
1060
+ | `json.loads` on each line | 163 | 0.12 |
1009
1061
  | jiter on each line (no string cache) | 94 | 0.21 |
1010
- | jiter on each line (string cache) | 84 | 0.23 |
1011
- | msgspec `decode` on each line | 75 | 0.26 |
1012
- | orjson on each line | 74 | 0.26 |
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 |
1013
1065
  | fastsimdjson `loads` on each line | 58 | 0.34 |
1014
1066
  | msgspec `decode_lines` | 55 | 0.36 |
1015
1067
  | fastsimdjson `loads_many` | 49 | 0.40 |
1016
- | fastsimdjson `parse_many` (views only) | 17 | 1.13 |
1068
+ | fastsimdjson `parse_many` (views only) | 17 | 1.14 |
1017
1069
 
1018
1070
  `loads_many` is 13% faster than msgspec's `decode_lines`. `parse_many` only creates the views; reading values from them adds to
1019
1071
  its time.
@@ -1026,12 +1078,12 @@ disabled (see below), Intel Xeon Gold 6548N (64 cores); GB/s:
1026
1078
 
1027
1079
  | threads | 1 | 2 | 4 | 8 | 16 | 32 | 64 |
1028
1080
  |---|---:|---:|---:|---:|---:|---:|---:|
1029
- | `map_many(len, data, threads=N)` | 0.90 | 1.64 | 2.08 | 3.53 | 5.85 | 8.70 | 16.8 |
1030
- | `parse_many(data, threads=N)` | 1.59 | 2.78 | 3.75 | 4.79 | 9.01 | 13.5 | **20.6** |
1031
- | `loads_many(data, threads=N)` | 0.77 | 1.52 | 2.29 | 4.08 | 6.87 | 9.99 | 11.8 |
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 |
1032
1084
 
1033
- `map_many` is 19 times faster on 64 threads than on one, and `parse_many` 13
1034
- times. `loads_many` builds every document for the calling thread and is 15
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
1035
1087
  times faster. On 64 threads, these numbers vary by up to a third from one
1036
1088
  run to the next. With the collector enabled,
1037
1089
  Python collects after the call returns: it examines the millions of objects