Skip to content

Commit 7fee368

Browse files
author
Steve Hanson
committed
Revert "revert perftest"
This reverts commit 221e8d5.
1 parent 221e8d5 commit 7fee368

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

test/perftest/schematest.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ RAPIDJSON_DIAG_POP
5151

5252
class Schema : public PerfTest {
5353
public:
54+
typedef GenericSchemaDocument<Value, MemoryPoolAllocator<> > SchemaDocumentType;
55+
5456
Schema() {}
5557

5658
virtual void SetUp() {
@@ -89,6 +91,8 @@ class Schema : public PerfTest {
8991

9092
char jsonBuffer[65536];
9193
MemoryPoolAllocator<> jsonAllocator(jsonBuffer, sizeof(jsonBuffer));
94+
char schemaBuffer[65536];
95+
MemoryPoolAllocator<> schemaAllocator(schemaBuffer, sizeof(schemaBuffer));
9296

9397
for (size_t i = 0; i < ARRAY_SIZE(filenames); i++) {
9498
char filename[FILENAME_MAX];
@@ -112,7 +116,7 @@ class Schema : public PerfTest {
112116
continue;
113117

114118
TestSuite* ts = new TestSuite;
115-
ts->schema = new SchemaDocument((*schemaItr)["schema"]);
119+
ts->schema = new SchemaDocumentType((*schemaItr)["schema"], 0, 0, 0, &schemaAllocator);
116120

117121
const Value& tests = (*schemaItr)["tests"];
118122
for (Value::ConstValueIterator testItr = tests.Begin(); testItr != tests.End(); ++testItr) {
@@ -187,7 +191,7 @@ class Schema : public PerfTest {
187191
for (DocumentList::iterator itr = tests.begin(); itr != tests.end(); ++itr)
188192
delete *itr;
189193
}
190-
SchemaDocument* schema;
194+
SchemaDocumentType* schema;
191195
DocumentList tests;
192196
};
193197

@@ -199,13 +203,14 @@ TEST_F(Schema, TestSuite) {
199203
char validatorBuffer[65536];
200204
MemoryPoolAllocator<> validatorAllocator(validatorBuffer, sizeof(validatorBuffer));
201205

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;
203208
int testCount = 0;
204209
clock_t start = clock();
205210
for (int i = 0; i < trialCount; i++) {
206211
for (TestSuiteList::const_iterator itr = testSuites.begin(); itr != testSuites.end(); ++itr) {
207212
const TestSuite& ts = **itr;
208-
GenericSchemaValidator<SchemaDocument, BaseReaderHandler<UTF8<> >, MemoryPoolAllocator<> > validator(*ts.schema, &validatorAllocator);
213+
GenericSchemaValidator<SchemaDocumentType, BaseReaderHandler<UTF8<> >, MemoryPoolAllocator<> > validator(*ts.schema, &validatorAllocator);
209214
for (DocumentList::const_iterator testItr = ts.tests.begin(); testItr != ts.tests.end(); ++testItr) {
210215
validator.Reset();
211216
(*testItr)->Accept(validator);

0 commit comments

Comments
 (0)