@@ -51,6 +51,8 @@ RAPIDJSON_DIAG_POP
51
51
52
52
class Schema : public PerfTest {
53
53
public:
54
+ typedef GenericSchemaDocument<Value, MemoryPoolAllocator<> > SchemaDocumentType;
55
+
54
56
Schema () {}
55
57
56
58
virtual void SetUp () {
@@ -89,6 +91,8 @@ class Schema : public PerfTest {
89
91
90
92
char jsonBuffer[65536 ];
91
93
MemoryPoolAllocator<> jsonAllocator (jsonBuffer, sizeof (jsonBuffer));
94
+ char schemaBuffer[65536 ];
95
+ MemoryPoolAllocator<> schemaAllocator (schemaBuffer, sizeof (schemaBuffer));
92
96
93
97
for (size_t i = 0 ; i < ARRAY_SIZE (filenames); i++) {
94
98
char filename[FILENAME_MAX];
@@ -112,7 +116,7 @@ class Schema : public PerfTest {
112
116
continue ;
113
117
114
118
TestSuite* ts = new TestSuite;
115
- ts->schema = new SchemaDocument ((*schemaItr)[" schema" ]);
119
+ ts->schema = new SchemaDocumentType ((*schemaItr)[" schema" ], 0 , 0 , 0 , &schemaAllocator );
116
120
117
121
const Value& tests = (*schemaItr)[" tests" ];
118
122
for (Value::ConstValueIterator testItr = tests.Begin (); testItr != tests.End (); ++testItr) {
@@ -187,7 +191,7 @@ class Schema : public PerfTest {
187
191
for (DocumentList::iterator itr = tests.begin (); itr != tests.end (); ++itr)
188
192
delete *itr;
189
193
}
190
- SchemaDocument * schema;
194
+ SchemaDocumentType * schema;
191
195
DocumentList tests;
192
196
};
193
197
@@ -199,13 +203,14 @@ TEST_F(Schema, TestSuite) {
199
203
char validatorBuffer[65536 ];
200
204
MemoryPoolAllocator<> validatorAllocator (validatorBuffer, sizeof (validatorBuffer));
201
205
202
- const int trialCount = 100000 ;
206
+ // DCOLES - Reduce number by a factor of 100 to make it more reasonable and inline with other test counts
207
+ const int trialCount = 1000 ;
203
208
int testCount = 0 ;
204
209
clock_t start = clock ();
205
210
for (int i = 0 ; i < trialCount; i++) {
206
211
for (TestSuiteList::const_iterator itr = testSuites.begin (); itr != testSuites.end (); ++itr) {
207
212
const TestSuite& ts = **itr;
208
- GenericSchemaValidator<SchemaDocument , BaseReaderHandler<UTF8<> >, MemoryPoolAllocator<> > validator (*ts.schema , &validatorAllocator);
213
+ GenericSchemaValidator<SchemaDocumentType , BaseReaderHandler<UTF8<> >, MemoryPoolAllocator<> > validator (*ts.schema , &validatorAllocator);
209
214
for (DocumentList::const_iterator testItr = ts.tests .begin (); testItr != ts.tests .end (); ++testItr) {
210
215
validator.Reset ();
211
216
(*testItr)->Accept (validator);
0 commit comments