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
Copy file name to clipboardExpand all lines: doc/performance.md
+17-1Lines changed: 17 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,13 +11,16 @@ are still some scenarios where tuning can enhance performance.
11
11
*[Computed GOTOs](#computed-gotos)
12
12
*[Number parsing](#number-parsing)
13
13
*[Visual Studio](#visual-studio)
14
+
*[Downclocking](#downclocking)
15
+
14
16
15
17
Reusing the parser for maximum efficiency
16
18
-----------------------------------------
17
19
18
20
If you're using simdjson to parse multiple documents, or in a loop, you should make a parser once
19
21
and reuse it. The simdjson library will allocate and retain internal buffers between parses, keeping
20
-
buffers hot in cache and keeping memory allocation and initialization to a minimum.
22
+
buffers hot in cache and keeping memory allocation and initialization to a minimum. In this manner,
23
+
you can parse terabytes of JSON data without doing any allocation.
21
24
22
25
```c++
23
26
dom::parser parser;
@@ -152,3 +155,16 @@ On Intel and AMD Windows platforms, Microsoft Visual Studio enables programmers
152
155
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
156
154
157
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.
158
+
159
+
160
+
Downclocking
161
+
--------------
162
+
163
+
On some Intel processors, using SIMD instructions in a sustained manner on the same CPU core may result in a phenomenon called downclocking whereas the processor initially runs these instructions at a slow speed before reducing the frequency of the core for a short time (milliseconds). Intel refers to these states as licenses. On some current Intel processors, it occurs under two scenarios:
164
+
165
+
-[Whenever 512-bit AVX-512 instructions are used](https://lemire.me/blog/2018/09/07/avx-512-when-and-how-to-use-these-new-instructions/).
166
+
- Whenever heavy 256-bit or wider instructions are used. Heavy instructions are those involving floating point operations or integer multiplications (since these execute on the floating point unit).
167
+
168
+
The simdjson library does not currently support AVX-512 instructions and it does not make use of heavy 256-bit instructions. Thus there is no downclocking due to simdjson.
169
+
170
+
For other reasons, you may still be worried about which SIMD instruction set is used by simdjson. Thankfully, [you can always determine and change which architecture-specific implementation is used](implementation-selection.md). Thus even if your CPU supports AVX2, you do not need to use AVX2.
0 commit comments