Update basics.md

This commit is contained in:
Daniel Lemire 2021-03-16 17:56:32 -04:00 committed by GitHub
parent 9294e8b098
commit 156b1b20e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -111,7 +111,7 @@ auto json = "[1,2,3]"_padded; // The _padded suffix creates a simdjson::padded_s
ondemand::document doc = parser.iterate(json); // parse a string
```
If you have a buffer of your own with enough padding already (SIMDJSON_PADDING extra bytes allocated), you can use `promise_padded` to pass it in:
If you have a buffer of your own with enough padding already (SIMDJSON_PADDING extra bytes allocated), you can use `padded_string_view` to pass it in:
```c++
ondemand::parser parser;
@ -120,6 +120,9 @@ strcpy(json, "[1]");
ondemand::document doc = parser.iterate(json, strlen(json), sizeof(json));
```
We recommend against creating many `std::string` or many `std::padding_string` instances in your application to store your JSON data.
Consider reusing the same buffers and limiting memory allocations.
Documents Are Iterators
-----------------------