Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
R
rapidjson
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
rapidjson
Commits
28f11ac4
Commit
28f11ac4
authored
Feb 03, 2016
by
Milo Yip
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix schema performance stats
parent
b8a27370
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
8 deletions
+11
-8
schema.md
doc/schema.md
+2
-2
schema.zh-cn.md
doc/schema.zh-cn.md
+2
-2
schematest.cpp
test/perftest/schematest.cpp
+7
-4
No files found.
doc/schema.md
View file @
28f11ac4
...
...
@@ -221,7 +221,7 @@ On a Mac Book Pro (2.8 GHz Intel Core i7), the following results are collected.
|Validator|Relative speed|Number of test runs per second|
|---------|:------------:|:----------------------------:|
|RapidJSON|
36521%|7220217
|
|RapidJSON|
155%|30682
|
|
[
`ajv`
](
https://github.com/epoberezkin/ajv
)
|100%|19770 (± 1.31%)|
|
[
`is-my-json-valid`
](
https://github.com/mafintosh/is-my-json-valid
)
|70%|13835 (± 2.84%)|
|
[
`jsen`
](
https://github.com/bugventure/jsen
)
|57.7%|11411 (± 1.27%)|
...
...
@@ -234,4 +234,4 @@ On a Mac Book Pro (2.8 GHz Intel Core i7), the following results are collected.
|tv4|0.5%|93 (± 0.94%)|
|
[
`jayschema`
](
https://github.com/natesilva/jayschema
)
|0.1%|21 (± 1.14%)|
That is, RapidJSON is about
~365 times faster than the fastest JavaScript library (ajv). And ~344 thousand times
faster than the slowest one.
That is, RapidJSON is about
1.5x faster than the fastest JavaScript library (ajv). And 1400x
faster than the slowest one.
doc/schema.zh-cn.md
View file @
28f11ac4
...
...
@@ -221,7 +221,7 @@ RapidJSON 实现了一个简单的 NFA 正则表达式引擎,并预设使用
|校验器|相对速度|每秒执行的测试数目|
|---------|:------------:|:----------------------------:|
|RapidJSON|
36521%|7220217
|
|RapidJSON|
155%|30682
|
|
[
`ajv`
](
https://github.com/epoberezkin/ajv
)
|100%|19770 (± 1.31%)|
|
[
`is-my-json-valid`
](
https://github.com/mafintosh/is-my-json-valid
)
|70%|13835 (± 2.84%)|
|
[
`jsen`
](
https://github.com/bugventure/jsen
)
|57.7%|11411 (± 1.27%)|
...
...
@@ -234,4 +234,4 @@ RapidJSON 实现了一个简单的 NFA 正则表达式引擎,并预设使用
|tv4|0.5%|93 (± 0.94%)|
|
[
`jayschema`
](
https://github.com/natesilva/jayschema
)
|0.1%|21 (± 1.14%)|
换言之,RapidJSON 比最快的 JavaScript 库(ajv)快约
365 倍。比最慢的快 34 万倍
。
换言之,RapidJSON 比最快的 JavaScript 库(ajv)快约
1.5x。比最慢的快 1400x
。
test/perftest/schematest.cpp
View file @
28f11ac4
...
...
@@ -100,7 +100,8 @@ public:
}
for
(
Value
::
ConstValueIterator
schemaItr
=
d
.
Begin
();
schemaItr
!=
d
.
End
();
++
schemaItr
)
{
if
(
IsExcludeTestSuite
((
*
schemaItr
)[
"description"
].
GetString
()))
std
::
string
schemaDescription
=
(
*
schemaItr
)[
"description"
].
GetString
();
if
(
IsExcludeTestSuite
(
schemaDescription
))
continue
;
TestSuite
*
ts
=
new
TestSuite
;
...
...
@@ -108,7 +109,7 @@ public:
const
Value
&
tests
=
(
*
schemaItr
)[
"tests"
];
for
(
Value
::
ConstValueIterator
testItr
=
tests
.
Begin
();
testItr
!=
tests
.
End
();
++
testItr
)
{
if
(
IsExcludeTest
((
*
testItr
)[
"description"
].
GetString
()))
if
(
IsExcludeTest
(
schemaDescription
+
", "
+
(
*
testItr
)[
"description"
].
GetString
()))
continue
;
Document
*
d2
=
new
Document
;
...
...
@@ -191,9 +192,10 @@ TEST_F(Schema, TestSuite) {
char
validatorBuffer
[
65536
];
MemoryPoolAllocator
<>
validatorAllocator
(
validatorBuffer
,
sizeof
(
validatorBuffer
));
const
int
trialCount
=
100000
;
int
testCount
=
0
;
clock_t
start
=
clock
();
for
(
int
i
=
0
;
i
<
10000
;
i
++
)
{
for
(
int
i
=
0
;
i
<
trialCount
;
i
++
)
{
for
(
TestSuiteList
::
const_iterator
itr
=
testSuites
.
begin
();
itr
!=
testSuites
.
end
();
++
itr
)
{
const
TestSuite
&
ts
=
**
itr
;
GenericSchemaValidator
<
SchemaDocument
,
BaseReaderHandler
<
UTF8
<>
>
,
MemoryPoolAllocator
<>
>
validator
(
*
ts
.
schema
,
&
validatorAllocator
);
...
...
@@ -207,7 +209,8 @@ TEST_F(Schema, TestSuite) {
}
clock_t
end
=
clock
();
double
duration
=
double
(
end
-
start
)
/
CLOCKS_PER_SEC
;
printf
(
"%d tests in %f s -> %f tests per sec
\n
"
,
testCount
,
duration
,
testCount
/
duration
);
printf
(
"%d trials in %f s -> %f trials per sec
\n
"
,
trialCount
,
duration
,
trialCount
/
duration
);
printf
(
"%d tests per trial
\n
"
,
testCount
/
trialCount
);
}
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment