Skip to content

Commit f65d238

Browse files
committed
Update
1 parent 75e616d commit f65d238

17 files changed

+81
-54
lines changed

en/README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,24 @@ Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights
1313

1414
## Build status
1515

16-
| [Linux][lin-link] | [Windows][win-link] |
17-
| :---------------: | :-----------------: |
18-
| ![lin-badge] | ![win-badge] |
16+
| [Linux][lin-link] | [Windows][win-link] | [Coveralls][cov-link] |
17+
| :---------------: | :-----------------: | :-------------------: |
18+
| ![lin-badge] | ![win-badge] | ![cov-badge] |
1919

20-
[lin-badge]: https://travis-ci.org/miloyip/rapidjson.png "Travis build status"
20+
[lin-badge]: https://travis-ci.org/miloyip/rapidjson.png?branch=master "Travis build status"
2121
[lin-link]: https://travis-ci.org/miloyip/rapidjson "Travis build status"
22-
[win-badge]: https://ci.appveyor.com/api/projects/status/u658dcuwxo14a8m9/branch/master?svg=true "AppVeyor build status"
22+
[win-badge]: https://ci.appveyor.com/api/projects/status/u658dcuwxo14a8m9/branch/master "AppVeyor build status"
2323
[win-link]: https://ci.appveyor.com/project/miloyip/rapidjson/branch/master "AppVeyor build status"
24+
[cov-badge]: https://coveralls.io/repos/miloyip/rapidjson/badge.png?branch=master
25+
[cov-link]: https://coveralls.io/r/miloyip/rapidjson?branch=master
2426

2527
## Introduction
2628

2729
RapidJSON is a JSON parser and generator for C++. It was inspired by [RapidXml](http://rapidxml.sourceforge.net/).
2830

2931
* RapidJSON is small but complete. It supports both SAX and DOM style API. The SAX parser is only a half thousand lines of code.
3032

31-
* RapidJSON is fast. Its performance can be comparable to `strlen()`. It also optionally supports SSE2/SSE4.1 for acceleration.
33+
* RapidJSON is fast. Its performance can be comparable to `strlen()`. It also optionally supports SSE2/SSE4.2 for acceleration.
3234

3335
* RapidJSON is self-contained. It does not depend on external libraries such as BOOST. It even does not depend on STL.
3436

en/doc/dom.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,29 +84,25 @@ template <typename InputStream>
8484
GenericDocument& GenericDocument::ParseStream(InputStream& is);
8585

8686
// (4) In situ parsing
87-
template <unsigned parseFlags, typename SourceEncoding>
88-
GenericDocument& GenericDocument::ParseInsitu(Ch* str);
89-
90-
// (5) In situ parsing, using same Encoding of Document
9187
template <unsigned parseFlags>
9288
GenericDocument& GenericDocument::ParseInsitu(Ch* str);
9389

94-
// (6) In situ parsing, using default parse flags
90+
// (5) In situ parsing, using default parse flags
9591
GenericDocument& GenericDocument::ParseInsitu(Ch* str);
9692

97-
// (7) Normal parsing of a string
93+
// (6) Normal parsing of a string
9894
template <unsigned parseFlags, typename SourceEncoding>
9995
GenericDocument& GenericDocument::Parse(const Ch* str);
10096

101-
// (8) Normal parsing of a string, using same Encoding of Document
97+
// (7) Normal parsing of a string, using same Encoding of Document
10298
template <unsigned parseFlags>
10399
GenericDocument& GenericDocument::Parse(const Ch* str);
104100

105-
// (9) Normal parsing of a string, using default parse flags
101+
// (8) Normal parsing of a string, using default parse flags
106102
GenericDocument& GenericDocument::Parse(const Ch* str);
107103
~~~~~~~~~~
108104
109-
The examples of [tutorial](doc/tutorial.md) uses (9) for normal parsing of string. The examples of [stream](doc/stream.md) uses the first three. *In situ* parsing will be described soon.
105+
The examples of [tutorial](doc/tutorial.md) uses (8) for normal parsing of string. The examples of [stream](doc/stream.md) uses the first three. *In situ* parsing will be described soon.
110106
111107
The `parseFlags` are combination of the following bit-flags:
112108

en/doc/dom.zh-cn.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,29 +84,25 @@ template <typename InputStream>
8484
GenericDocument& GenericDocument::ParseStream(InputStream& is);
8585

8686
// (4) 原位解析
87-
template <unsigned parseFlags, typename SourceEncoding>
88-
GenericDocument& GenericDocument::ParseInsitu(Ch* str);
89-
90-
// (5) 原位解析,使用Document的编码
9187
template <unsigned parseFlags>
9288
GenericDocument& GenericDocument::ParseInsitu(Ch* str);
9389

94-
// (6) 原位解析,使用缺省标志
90+
// (5) 原位解析,使用缺省标志
9591
GenericDocument& GenericDocument::ParseInsitu(Ch* str);
9692

97-
// (7) 正常解析一个字符串
93+
// (6) 正常解析一个字符串
9894
template <unsigned parseFlags, typename SourceEncoding>
9995
GenericDocument& GenericDocument::Parse(const Ch* str);
10096

101-
// (8) 正常解析一个字符串,使用Document的编码
97+
// (7) 正常解析一个字符串,使用Document的编码
10298
template <unsigned parseFlags>
10399
GenericDocument& GenericDocument::Parse(const Ch* str);
104100

105-
// (9) 正常解析一个字符串,使用缺省标志
101+
// (8) 正常解析一个字符串,使用缺省标志
106102
GenericDocument& GenericDocument::Parse(const Ch* str);
107103
~~~~~~~~~~
108104
109-
[教程](tutorial.md)中的例使用(9)去正常解析字符串。而[流](stream.md)的例子使用前3个函数。我们将稍后介绍原位(*In situ*) 解析。
105+
[教程](tutorial.md)中的例使用(8)去正常解析字符串。而[流](stream.md)的例子使用前3个函数。我们将稍后介绍原位(*In situ*) 解析。
110106
111107
`parseFlags`是以下位标置的组合:
112108

en/doc/faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@
198198

199199
3. What is SIMD? How it is applied in RapidJSON?
200200

201-
[SIMD](http://en.wikipedia.org/wiki/SIMD) instructions can perform parallel computation in modern CPUs. RapidJSON support Intel's SSE2/SSE4.1 to accelerate whitespace skipping. This improves performance of parsing indent formatted JSON.
201+
[SIMD](http://en.wikipedia.org/wiki/SIMD) instructions can perform parallel computation in modern CPUs. RapidJSON support Intel's SSE2/SSE4.2 to accelerate whitespace skipping. This improves performance of parsing indent formatted JSON. Define `RAPIDJSON_SSE2` or `RAPIDJSON_SSE42` macro to enable this feature. However, running the executable on a machine without such instruction set support will make it crash.
202202

203203
4. Does it consume a lot of memory?
204204

en/doc/faq.zh-cn.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@
198198

199199
3. 什是是SIMD?它如何用于RapidJSON?
200200

201-
[SIMD](http://en.wikipedia.org/wiki/SIMD)指令可以在现代CPU中执行并行运算。RapidJSON支持了Intel的SSE2/SSE4.1去加速跳过空白字符。在解析含缩进的JSON时,这能提升性能。
201+
[SIMD](http://en.wikipedia.org/wiki/SIMD)指令可以在现代CPU中执行并行运算。RapidJSON支持了Intel的SSE2/SSE4.2去加速跳过空白字符。在解析含缩进的JSON时,这能提升性能。只要定义名为`RAPIDJSON_SSE2``RAPIDJSON_SSE42`的宏,就能启动这个功能。然而,若在不支持这些指令集的机器上执行这些可执行文件,会导致崩溃
202202

203203
4. 它会消耗许多内存么?
204204

en/doc/features.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* High performance
1616
* Use template and inline functions to reduce function call overheads.
1717
* Internal optimized Grisu2 and floating point parsing implementations.
18-
* Optional SSE2/SSE4.1 support.
18+
* Optional SSE2/SSE4.2 support.
1919

2020
## Standard compliance
2121

en/doc/features.zh-cn.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* 高性能
1616
* 使用模版及内联函数去降低函数调用开销。
1717
* 内部经优化的Grisu2及浮点数解析实现。
18-
* 可选的SSE2/SSE4.1支持
18+
* 可选的SSE2/SSE4.2支持
1919

2020
## 符合标准
2121

en/doc/internals.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,21 @@ void SkipWhitespace(InputStream& s) {
183183
184184
However, this requires 4 comparisons and a few branching for each character. This was found to be a hot spot.
185185
186-
To accelerate this process, SIMD was applied to compare 16 characters with 4 white spaces for each iteration. Currently RapidJSON only supports SSE2 and SSE4.1 instructions for this. And it is only activated for UTF-8 memory streams, including string stream or *in situ* parsing.
186+
To accelerate this process, SIMD was applied to compare 16 characters with 4 white spaces for each iteration. Currently RapidJSON only supports SSE2 and SSE4.2 instructions for this. And it is only activated for UTF-8 memory streams, including string stream or *in situ* parsing.
187+
188+
To enable this optimization, need to define `RAPIDJSON_SSE2` or `RAPIDJSON_SSE42` before including `rapidjson.h`. Some compilers can detect the setting, as in `perftest.h`:
189+
190+
~~~cpp
191+
// __SSE2__ and __SSE4_2__ are recognized by gcc, clang, and the Intel compiler.
192+
// We use -march=native with gmake to enable -msse2 and -msse4.2, if supported.
193+
#if defined(__SSE4_2__)
194+
# define RAPIDJSON_SSE42
195+
#elif defined(__SSE2__)
196+
# define RAPIDJSON_SSE2
197+
#endif
198+
~~~
199+
200+
Note that, these are compile-time settings. Running the executable on a machine without such instruction set support will make it crash.
187201

188202
## Local Stream Copy {#LocalStreamCopy}
189203

rapidjson

zh-cn/README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,26 @@ Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights
1010
* [简体中文](http://miloyip.github.io/rapidjson/zh-cn/)
1111
* [GitBook](https://www.gitbook.com/book/miloyip/rapidjson/)可下载PDF/EPUB/MOBI,但不含API参考手册。
1212

13+
## Build 状态
14+
15+
| [Linux][lin-link] | [Windows][win-link] | [Coveralls][cov-link] |
16+
| :---------------: | :-----------------: | :-------------------: |
17+
| ![lin-badge] | ![win-badge] | ![cov-badge] |
18+
19+
[lin-badge]: https://travis-ci.org/miloyip/rapidjson.png?branch=master "Travis build status"
20+
[lin-link]: https://travis-ci.org/miloyip/rapidjson "Travis build status"
21+
[win-badge]: https://ci.appveyor.com/api/projects/status/u658dcuwxo14a8m9/branch/master "AppVeyor build status"
22+
[win-link]: https://ci.appveyor.com/project/miloyip/rapidjson/branch/master "AppVeyor build status"
23+
[cov-badge]: https://coveralls.io/repos/miloyip/rapidjson/badge.png?branch=master
24+
[cov-link]: https://coveralls.io/r/miloyip/rapidjson?branch=master
25+
1326
## 简介
1427

1528
RapidJSON是一个C++的JSON解析器及生成器。它的灵感来自[RapidXml](http://rapidxml.sourceforge.net/)
1629

1730
* RapidJSON小而全。它同时支持SAX和DOM风格的API。SAX解析器只有约500行代码。
1831

19-
* RapidJSON快。它的性能可与`strlen()`相比。可支持SSE2/SSE4.1加速
32+
* RapidJSON快。它的性能可与`strlen()`相比。可支持SSE2/SSE4.2加速
2033

2134
* RapidJSON独立。它不依赖于BOOST等外部库。它甚至不依赖于STL。
2235

0 commit comments

Comments
 (0)