Skip to content

Commit f59d870

Browse files
committed
Update README
1 parent bcf9e18 commit f59d870

File tree

1 file changed

+46
-20
lines changed

1 file changed

+46
-20
lines changed

README.md

Lines changed: 46 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,61 @@
1-
# simdjson_php
1+
`awesome/simdjson_plus`
2+
=======================
23

3-
🚀 Blazing-fast JSON encoding and decoding for PHP, powered by the [simdjson project](https://github.com/lemire/simdjson).
4+
[![Build Status](https://github.com/awesomized/simdjson-plus-php-ext/actions/workflows/integration.yml/badge.svg?branch=master)](https://github.com/awesomized/simdjson-plus-php-ext/actions/workflows/integration.yml?query=branch%3Amaster)
5+
[![Latest Stable Version](https://img.shields.io/packagist/v/awesome/simdjson_plus)](https://packagist.org/packages/awesome/simdjson_plus)
46

5-
*This is a fork of [crazyxman/simdjson_php](https://github.com/crazyxman/simdjson_php) with new optimisations and encoding support.*
7+
🚀 Blazing-fast JSON encoding and decoding for PHP, powered by the
8+
[simdjson project](https://github.com/lemire/simdjson).
69

7-
[![Build Status](https://github.com/JakubOnderka/simdjson_php/actions/workflows/integration.yml/badge.svg?branch=master)](https://github.com/JakubOnderka/simdjson_php/actions/workflows/integration.yml?query=branch%3Amaster)
10+
*This is a fork of [JakubOnderka/simdjson_php](https://github.com/JakubOnderka/simdjson_php) (which is a fork of [crazyxman/simdjson_php](https://github.com/crazyxman/simdjson_php)), which adds JSON
11+
encoding support with new optimisations.*
812

9-
## Performance Comparison: How Fast is simdjson_php?
13+
Since the [simdjson](https://pecl.php.net/package/simdjson) PECL extension seems to be unmaintained, or at least slow
14+
to [accept PRs for improvements](https://github.com/crazyxman/simdjson_php/pulls), we packaged this up under a new
15+
name (`simdjson_plus`) to avoid conflicts and published it on Packagist (instead of PECL).
1016

11-
| Operation | PHP Built-in | simdjson_php | Speedup |
12-
|-----------------------|--------------|--------------|----------|
13-
| Decode to array | 1.48 ms | 0.46 ms | **3.2×** |
14-
| Decode to object | 1.56 ms | 0.54 ms | **2.9×** |
15-
| Encode | 0.67 ms | 0.26 ms | **2.5×** |
16-
| Encode (pretty print) | 0.83 ms | 0.31 ms | **2.6×** |
17-
| Validate | 1.37 ms | 0.22 ms | **6.2×** |
18-
| Count items | 1.51 ms | 0.16 ms | **9.4×** |
17+
## Performance Comparison: How Fast is simdjson_plus?
18+
19+
| Operation | PHP Built-in | simdjson_plus | Speedup |
20+
|-----------------------|--------------|---------------|----------|
21+
| Decode to array | 1.48 ms | 0.46 ms | **3.2×** |
22+
| Decode to object | 1.56 ms | 0.54 ms | **2.9×** |
23+
| Encode | 0.67 ms | 0.26 ms | **2.5×** |
24+
| Encode (pretty print) | 0.83 ms | 0.31 ms | **2.6×** |
25+
| Validate | 1.37 ms | 0.22 ms | **6.2×** |
26+
| Count items | 1.51 ms | 0.16 ms | **9.4×** |
1927

2028
Tests were conducted using PHP 8.3 on an [Apple M1 Max](https://en.wikipedia.org/wiki/Apple_M1#M1_Pro_and_M1_Max). For test specification see `TwitterDecodeBench.php` and `TwitterEncoderBench.php`.
2129

22-
Additionally, simdjson_php reduces memory usage compared to `json_decode()`. For example, when decoding twitter.json, memory consumption drops from 3.01 MB to 2.47 MB due to efficient array key deduplication.
30+
Additionally, simdjson_plus reduces memory usage compared to `json_decode()`. For example, when decoding twitter.json, memory consumption drops from 3.01 MB to 2.47 MB due to efficient array key deduplication.
31+
32+
## Related SIMD-accelerated PHP extensions
33+
* [crc_fast](https://packagist.org/packages/awesome/crc_fast) PHP extension for SIMD-accelerated CRC calculations
34+
at >100GiB/s.
35+
* [simdutf](https://packagist.org/packages/awesome/simdutf) PHP extension for Unicode validation and transcoding at
36+
billions of characters per second using the [simdutf](https://github.com/simdutf/simdutf) project.
2337

24-
## Requirement
38+
## Requirements
2539

26-
* PHP 8.0+ (PHP 8.2+ recommended for maximum performance)
40+
* PHP 8.1+ (PHP 8.2+ recommended for maximum performance)
2741
* g++ (version 7 or better) or clang++ (version 6 or better)
2842
* A 64-bit system with a command-line shell (e.g., Linux, macOS, FreeBSD)
2943

44+
## Changes
45+
46+
See the [change log](CHANGELOG.md).
47+
48+
## Installing
49+
50+
Use [Composer](https://getcomposer.org) to install this library using [PIE](https://github.com/php/pie):
51+
52+
```bash
53+
composer install awesome/simdjson-plus
54+
```
55+
3056
## Compilation Instructions for Linux
3157

32-
To compile simdjson_php, run the following commands:
58+
To compile simdjson_plus, run the following commands:
3359

3460
```bash
3561
phpize
@@ -42,7 +68,7 @@ make install
4268
Once installed, add this line to your `php.ini` file:
4369

4470
```ini
45-
extension=simdjson.so
71+
extension=simdjson_plus.so
4672
```
4773

4874
## Usage Examples
@@ -141,7 +167,7 @@ You can also use base64url encoding (RFC 4648 §5) by setting second argument to
141167

142168
### Encode to stream
143169

144-
For large data sets, simdjson_php provides the `simdjson_encode_to_stream()` function to save data directly to a file or output buffer.
170+
For large data sets, simdjson_plus provides the `simdjson_encode_to_stream()` function to save data directly to a file or output buffer.
145171

146172
```php
147173
$bigStructure = [...];
@@ -174,4 +200,4 @@ simdjson_decode_from_stream(fopen("php://input", "r")); // send by user
174200
```
175201

176202
## Benchmarks
177-
See the [benchmark](./benchmark) folder for more benchmarks.
203+
See the [benchmark](./benchmark) folder for more benchmarks.

0 commit comments

Comments
 (0)