Skip to content

Commit 999a40d

Browse files
authored
Update README.md
1 parent 0317287 commit 999a40d

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

README.md

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ One key difference is that the Mison parser makes moderate use of the SIMD instr
1616
We find that, for some inputs, we are limited in speed: for canada.json, marine_ik, mesh.json, mesh-pretty, about half of the processing time is due to number parsing (mostly floating-point numbers); for twitterescaped and random, string parsing is a burden.
1717

1818

19-
We present the time (in cycles per input byte) needed to fully parse a JSON file (with error checking) and to collect some statistics about the document (e.g., the number of integers), for some JSON files. For these tests, we use an Intel processor with a Skylake microarchitecture. All results are single-threaded.
20-
21-
*Lower results are better.*
19+
Next we present the time (in cycles per input byte) needed to fully parse a JSON file (with error checking) and to collect some statistics about the document (e.g., the number of integers), for some JSON files. For these tests, we use an Intel processor with a Skylake microarchitecture. All results are single-threaded. *Lower results are better.*
2220

2321

2422

@@ -88,7 +86,26 @@ if( ! pj.isValid() ) {
8886

8987
See the "singleheader" repository for a single header version. See the included
9088
file "amalgamation_demo.cpp" for usage. This requires no specific build system: just
91-
copy the files in your project.
89+
copy the files in your project in your include path. You can then include them quite simply:
90+
91+
```
92+
#include <iostream>
93+
#include "simdjson.h"
94+
#include "simdjson.cpp"
95+
int main(int argc, char *argv[]) {
96+
const char * filename = argv[1];
97+
std::string_view p = get_corpus(filename);
98+
ParsedJson pj = build_parsed_json(p); // do the parsing
99+
if( ! pj.isValid() ) {
100+
std::cout << "not valid" << std::endl;
101+
} else {
102+
std::cout << "valid" << std::endl;
103+
}
104+
return EXIT_SUCCESS;
105+
}
106+
```
107+
108+
Note: In some settings, it might be desirable to precompile `simdjson.cpp` instead of including it.
92109

93110
## Usage (old-school Makefile on platforms like Linux or macOS)
94111

0 commit comments

Comments
 (0)