Skip to content

Commit

Permalink
update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
1ma committed Aug 11, 2019
1 parent 6ed839b commit 1df69f0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### [2.1.1] - 2019-08-12

* (Improvement) Control Json decoding algorithm with a flag to the JsonRpc Server.

### [2.1.0] - 2019-08-02

* (Feature) Transparently decode Json payloads with the [simdjson](https://github.com/crazyxman/simdjson_php) PHP bindings when they are available.
Expand Down Expand Up @@ -26,6 +30,7 @@

* Initial pre-release

[2.1.1]: https://github.com/1ma/JsonRpc/compare/v2.1.0...v2.1.1
[2.1.0]: https://github.com/1ma/JsonRpc/compare/v2.0.0...v2.1.0
[2.0.0]: https://github.com/1ma/JsonRpc/compare/v1.0.0...v2.0.0
[1.0.0]: https://github.com/1ma/JsonRpc/compare/v0.9.0...v1.0.0
Expand Down
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,25 @@ $response = $server->run('{"jsonrpc":"2.0","method":"add","params":[2,3],"id":1}
## Json Parsing
The library will try to decode Json payloads using the [simdjson PHP bindings] if they are available. When not
available the builtin `json_decode()` function will be used instead.
The library can use the [simdjson PHP bindings] to decode Json payloads if they are available.
These bindings integrate a [C++ Json decoder] written by Daniel Lemire into PHP. In the synthetic benchmarks bundled
with the extension it shows speedups ranging between 1.4x and 2x compared to `json_decode()`.
In order to use them you need to build and load the `simdjson` extension _and_ pass `true` as the optional third
parameter of the JsonRpc Server when you instantiate it. This extra step was added due to the fact that `simdjson`
relies on the `AVX2` and/or `SSE4.2` instruction sets to work, so you should check that you have either one of them
before switching to this parsing method.
On a Linux OS you can find out this information by peeking at the `/proc/cpuinfo` pseudofile:
```bash
$ grep avx2 /proc/cpuinfo
$ grep sse4_2 /proc/cpuinfo
```
If none of the above commands output anything you won't be able use `simdjson`.


## Concurrent Server

Expand Down

0 comments on commit 1df69f0

Please sign in to comment.