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
{{ message }}
Repository navigation
Commit fa4ce6a
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: HACKING.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,7 +41,7 @@ Other important files and directories:
41
41
***amalgamate.sh:** Generates singleheader/simdjson.h and singleheader/simdjson.cpp for release.
42
42
***benchmark:** This is where we do benchmarking. Benchmarking is core to every change we make; the
43
43
cardinal rule is don't regress performance without knowing exactly why, and what you're trading
44
-
for it. Many of our benchmarks are microbenchmarks. We trying to assess a specific functions in a specific library. In this scenario, we are effectively doing controlled scientific experiments for the purpose of understanding what affects our performance. So we simplify as much as possible. We try to avoid irrelevant factors such as page faults, interrupts, unnnecessary system calls, how fast and how eagerly the OS maps memory In such scenarios, we typically want to get the best performance that we can achieve... the case where we did not get interrupts, context switches, page faults... What we want is consistency and predictability. The numbers should not depend too much on how busy the machine is, on whether your upgraded your operating system recently, and so forth. This type of benchmarking is distinct from system benchmarking. If you're not sure what else to do to check your performance, this is always a good start:
44
+
for it. Many of our benchmarks are microbenchmarks. We are effectively doing controlled scientific experiments for the purpose of understanding what affects our performance. So we simplify as much as possible. We try to avoid irrelevant factors such as page faults, interrupts, unnnecessary system calls. We recommend checking the performance as follows:
45
45
```bash
46
46
mkdir build
47
47
cd build
@@ -53,11 +53,11 @@ Other important files and directories:
The last line becomes `./benchmark/Release/bench_parse_call.exe` under Windows. Under Windows, you can also build with the clang compiler by adding `-T ClangCL` to the call to `cmake ..`.
60
+
The last line becomes `./benchmark/Release/bench_parse_call.exe` under Windows. Under Windows, you can also build with the clang compiler by adding `-T ClangCL` to the call to `cmake ..`: `cmake .. - TClangCL`.
61
61
***fuzz:** The source for fuzz testing. This lets us explore important edge and middle cases
62
62
***fuzz:** The source for fuzz testing. This lets us explore important edge and middle cases
Copy file name to clipboardExpand all lines: README.md
+5-6Lines changed: 5 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -75,15 +75,14 @@ Usage documentation is available:
75
75
Performance results
76
76
-------------------
77
77
78
-
The simdjson library uses three-quarters less instructions than state-of-the-art parser RapidJSON and
78
+
The simdjson library uses three-quarters less instructions than state-of-the-art parser [RapidJSON](https://rapidjson.org) and
79
79
fifty percent less than sajson. To our knowledge, simdjson is the first fully-validating JSON parser
80
-
to run at gigabytes per second on commodity processors. It can parse millions of JSON documents
81
-
per second on a single core.
80
+
to run at [gigabytes per second](https://en.wikipedia.org/wiki/Gigabyte) (GB/s) on commodity processors. It can parse millions of JSON documents per second on a single core.
82
81
83
82
The following figure represents parsing speed in GB/s for parsing various files
84
83
on an Intel Skylake processor (3.4 GHz) using the GNU GCC 9 compiler (with the -O3 flag).
85
84
We compare against the best and fastest C++ libraries.
86
-
The simdjson library offers full unicode (UTF-8) validation and exact
85
+
The simdjson library offers full unicode ([UTF-8](https://en.wikipedia.org/wiki/UTF-8)) validation and exact
87
86
number parsing. The RapidJSON library is tested in two modes: fast and
88
87
exact number parsing. The sajson library offers fast (but not exact)
89
88
number parsing and partial unicode validation. In this data set, the file
@@ -183,8 +182,8 @@ Head over to [CONTRIBUTING.md](CONTRIBUTING.md) for information on contributing
183
182
License
184
183
-------
185
184
186
-
This code is made available under the Apache License 2.0.
185
+
This code is made available under the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0.html).
187
186
188
187
Under Windows, we build some tools using the windows/dirent_portable.h file (which is outside our library code): it under the liberal (business-friendly) MIT license.
189
188
190
-
For compilers that do not support C++17, we bundle the string-view library which is published under the Boost license (http://www.boost.org/LICENSE_1_0.txt). Like the Apache license, the Boost license is a permissive license allowing commercial redistribution.
189
+
For compilers that do not support [C++17](https://en.wikipedia.org/wiki/C%2B%2B17), we bundle the string-view library which is published under the Boost license (http://www.boost.org/LICENSE_1_0.txt). Like the Apache license, the Boost license is a permissive license allowing commercial redistribution.
Copy file name to clipboardExpand all lines: doc/performance.md
+14-2Lines changed: 14 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,8 @@ are still some scenarios where tuning can enhance performance.
9
9
*[Server Loops: Long-Running Processes and Memory Capacity](#server-loops-long-running-processes-and-memory-capacity)
10
10
*[Large files and huge page support](#large-files-and-huge-page-support)
11
11
*[Computed GOTOs](#computed-gotos)
12
+
*[Number parsing](#number-parsing)
13
+
*[Visual Studio](#visual-studio)
12
14
13
15
Reusing the parser for maximum efficiency
14
16
-----------------------------------------
@@ -61,7 +63,7 @@ without bound:
61
63
* You can set a *max capacity* when constructing a parser:
62
64
63
65
```c++
64
-
dom::parser parser(1024*1024); // Never grow past documents > 1MB
66
+
dom::parser parser(1000*1000); // Never grow past documents > 1MB
65
67
for (web_request request : listen()) {
66
68
auto [doc, error] = parser.parse(request.body);
67
69
// If the document was above our limit, emit 413 = payload too large
@@ -77,7 +79,7 @@ without bound:
77
79
78
80
```c++
79
81
dom::parser parser(0); // This parser will refuse to automatically grow capacity
80
-
simdjson::error_code allocate_error = parser.allocate(1024*1024); // This allocates enough capacity to handle documents <= 1MB
82
+
simdjson::error_code allocate_error = parser.allocate(1000*1000); // This allocates enough capacity to handle documents <= 1MB
81
83
if (allocate_error) { cerr << allocate_error << endl; exit(1); }
82
84
83
85
for (web_request request : listen()) {
@@ -140,3 +142,13 @@ few hundred megabytes per second if your JSON documents are densely packed with
140
142
- When possible, you should favor integer values written without a decimal point, as it simpler and faster to parse decimal integer values.
141
143
- When serializing numbers, you should not use more digits than necessary: 17 digits is all that is needed to exactly represent double-precision floating-point numbers. Using many more digits than necessary will make your files larger and slower to parse.
142
144
- When benchmarking parsing speeds, always report whether your JSON documents are made mostly of floating-point numbers when it is the case, since number parsing can then dominate the parsing time.
145
+
146
+
147
+
Visual Studio
148
+
--------------
149
+
150
+
On Intel and AMD Windows platforms, Microsoft Visual Studio enables programmers to build either 32-bit (x86) or 64-bit (x64) binaries. We urge you to always use 64-bit mode. Visual Studio 2019 should default on 64-bit builds when you have a 64-bit version of Windows, which we recommend.
151
+
152
+
We do not recommend that you compile simdjson with architecture-specific flags such as `arch:AVX2`. The simdjson library automatically selects the best execution kernel at runtime.
153
+
154
+
Recent versions of Microsoft Visual Studio on Windows provides support for the LLVM Clang compiler. You only need to install the "Clang compiler" optional component. You may also get a copy of the 64-bit LLVM CLang compiler for [Windows directly from LLVM](https://releases.llvm.org/download.html). The simdjson library fully supports the LLVM Clang compiler under Windows. In fact, you may get better performance out of simdjson with the LLVM Clang compiler than with the regular Visual Studio compiler.
0 commit comments