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
If you are planning to use simdjson in a product, please work from one of our releases.
68
70
@@ -143,11 +145,27 @@ The json stream parser is threaded, using exactly two threads.
143
145
144
146
## Large files
145
147
146
-
If you are processing large files (e.g., 100 MB), it is likely that the performance of simdjson will be limited by page misses and/or page allocation. [On some systems, memory allocation runs far slower than we can parse (e.g., 1.4GB/s).](https://lemire.me/blog/2020/01/14/how-fast-can-you-allocate-a-large-block-of-memory-in-c/)
148
+
If you are processing large files (e.g., 100 MB), it is possible that the performance of simdjson will be limited by page misses and/or page allocation. [On some systems, memory allocation runs far slower than we can parse (e.g., 1.4GB/s).](https://lemire.me/blog/2020/01/14/how-fast-can-you-allocate-a-large-block-of-memory-in-c/)
147
149
148
-
You will get best performance with large or huge pages. Under Linux, you can enable transparent huge pages with a command like `echo always > /sys/kernel/mm/transparent_hugepage/enabled` (root access may be required). We recommend that you report performance numbers with and without huge pages.
150
+
A viable strategy is to amortize the cost of page allocation by reusing the same `parser` object over several files:
151
+
152
+
```C++
153
+
// create one parser
154
+
simdjson::document::parser parser;
155
+
...
156
+
// the parser is going to pay a memory allocation price
157
+
auto [doc1, error1] = parser.parse(largestring1);
158
+
...
159
+
// use again the same parser, it will be faster
160
+
auto [doc2, error2] = parser.parse(largestring2);
161
+
...
162
+
auto [doc3, error3] = parser.load("largefilename");
163
+
```
164
+
165
+
If you cannot reuse the same parser instance, maybe because your application just processes one large document once, you will get best performance with large or huge pages. Under Linux, you can enable transparent huge pages with a command like `echo always > /sys/kernel/mm/transparent_hugepage/enabled` (root access may be required). It may be more difficult to achieve the same result under other systems like macOS or Windows.
166
+
167
+
In general, when running benchmarks over large files, we recommend that you report performance numbers with and without huge pages if possible. Furthermore, you should amortize the parsing (e.g., by parsing several large files) to distinguish the time spent parsing from the time spent allocating memory.
149
168
150
-
Another strategy is to reuse pre-allocated buffers. That is, you avoid reallocating memory. You just allocate memory once and reuse the blocks of memory.
Copy file name to clipboardExpand all lines: fuzz/Fuzzing.md
+9-3Lines changed: 9 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -6,9 +6,15 @@
6
6
-https://github.com/lemire/simdjson/issues/351
7
7
-https://github.com/lemire/simdjson/issues/345
8
8
9
-
Simdjson tries to follow [fuzzing best practises](https://google.github.io/oss-fuzz/advanced-topics/ideal-integration/#summary).
9
+
The simdjson library tries to follow [fuzzing best practises](https://google.github.io/oss-fuzz/advanced-topics/ideal-integration/#summary).
10
+
11
+
The simdjson library is continuously fuzzed on [oss-fuzz](https://github.com/google/oss-fuzz).
12
+
13
+
14
+
## Currently open bugs
15
+
16
+
You can find the currently opened bugs, if any at [bugs.chromium.org](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&q=proj%3Asimdjson&can=2): make sure not to miss the "Open Issues" selector. Bugs that are fixed by follow-up commits are automatically closed.
10
17
11
-
Simdjson is continuously fuzzed on [oss-fuzz](https://github.com/google/oss-fuzz).
12
18
13
19
## Fuzzing as a CI job
14
20
@@ -29,7 +35,7 @@ The corpus will grow over time and easy to find bugs will be detected already du
29
35
30
36
## Corpus
31
37
32
-
Simdjson does not benefit from a corpus as much as other projects, because the library is very fast and explores the input space very well. With that said, it is still beneficial to have one. The CI job stores the corpus on bintray between runs, and is available here: https://dl.bintray.com/pauldreik/simdjson-fuzz-corpus/corpus/corpus.tar
38
+
The simdjson library does not benefit from a corpus as much as other projects, because the library is very fast and explores the input space very well. With that said, it is still beneficial to have one. The CI job stores the corpus on bintray between runs, and is available here: https://dl.bintray.com/pauldreik/simdjson-fuzz-corpus/corpus/corpus.tar
33
39
34
40
One can also grab the corpus as an artifact from the github actions job. Pick a run, then go to artifacts and download.
0 commit comments