You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+8-4Lines changed: 8 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@
3
3
4
4
A basic lua binding to [simdjson](https://simdjson.org). The simdjson library is an incredibly fast JSON parser that uses SIMD instructions and fancy algorithms to parse JSON very quickly. It's been tested with LuaJIT 2.0/2.1 and Lua 5.1, 5.2, 5.3, and 5.4 on linux/osx. It has a general parsing mode and a lazy mode that uses a JSON pointer.
5
5
6
-
Current simdjson version: 0.3.1
6
+
Current simdjson version: 0.5.0
7
7
8
8
## Requirements
9
9
* lua-simdjson only works on 64bit systems.
@@ -71,16 +71,18 @@ local response = simdjson.open([[
print(fileResponse:at("statuses/0/id")) --using a JSON pointer
78
+
print(fileResponse:atPointer("/statuses/0/id")) --using a JSON pointer
79
79
80
80
```
81
+
Starting with version 0.5.0, the the `atPointer` method is JSON pointer compliant. The previous pointer implementation is considered deprecated, but is still available with the `at` method.
82
+
81
83
The `open` and `parse` codeblocks should print out the same values. It's worth noting that the JSON pointer indexes from 0.
82
84
83
-
This lazy style of using the simdjson data structure could also be used with array access in the future, and would result in ultra-fast JSON parsing.
85
+
This lazy style of using the simdjson data structure could also be used with array access in the future, and would result in ultra-fast JSON "parsing".
84
86
85
87
## Error Handling
86
88
lua-simdjson will error out with any errors from simdjson encountered while parsing. They are very good at helping identify what has gone wrong during parsing.
@@ -96,6 +98,8 @@ I also calculated the throughput for each of the files to show how it may affect
96
98
97
99
All tested files are in the [jsonexamples folder](jsonexamples/).
98
100
101
+
lua-simdjson, like the simdjson library performs better on more modern hardware. These benchmarks were run on a ninth-gen i7 processor. On an older processor, rapidjson may perform better.
102
+
99
103
## Caveats & Alternatives
100
104
* there is no encoding/dumping a lua table to JSON (yet! Most other lua JSON libraries can handle this)
101
105
* it only works on 64 bit systems (untested on Windows...)
0 commit comments