Revert "revert perftest"
This reverts commit 221e8d5364d817f3ea89ec0e124e2fa68a696952.
This commit is contained in:
parent
221e8d5364
commit
7fee368be3
@ -51,6 +51,8 @@ RAPIDJSON_DIAG_POP
|
|||||||
|
|
||||||
class Schema : public PerfTest {
|
class Schema : public PerfTest {
|
||||||
public:
|
public:
|
||||||
|
typedef GenericSchemaDocument<Value, MemoryPoolAllocator<> > SchemaDocumentType;
|
||||||
|
|
||||||
Schema() {}
|
Schema() {}
|
||||||
|
|
||||||
virtual void SetUp() {
|
virtual void SetUp() {
|
||||||
@ -89,6 +91,8 @@ public:
|
|||||||
|
|
||||||
char jsonBuffer[65536];
|
char jsonBuffer[65536];
|
||||||
MemoryPoolAllocator<> jsonAllocator(jsonBuffer, sizeof(jsonBuffer));
|
MemoryPoolAllocator<> jsonAllocator(jsonBuffer, sizeof(jsonBuffer));
|
||||||
|
char schemaBuffer[65536];
|
||||||
|
MemoryPoolAllocator<> schemaAllocator(schemaBuffer, sizeof(schemaBuffer));
|
||||||
|
|
||||||
for (size_t i = 0; i < ARRAY_SIZE(filenames); i++) {
|
for (size_t i = 0; i < ARRAY_SIZE(filenames); i++) {
|
||||||
char filename[FILENAME_MAX];
|
char filename[FILENAME_MAX];
|
||||||
@ -112,7 +116,7 @@ public:
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
TestSuite* ts = new TestSuite;
|
TestSuite* ts = new TestSuite;
|
||||||
ts->schema = new SchemaDocument((*schemaItr)["schema"]);
|
ts->schema = new SchemaDocumentType((*schemaItr)["schema"], 0, 0, 0, &schemaAllocator);
|
||||||
|
|
||||||
const Value& tests = (*schemaItr)["tests"];
|
const Value& tests = (*schemaItr)["tests"];
|
||||||
for (Value::ConstValueIterator testItr = tests.Begin(); testItr != tests.End(); ++testItr) {
|
for (Value::ConstValueIterator testItr = tests.Begin(); testItr != tests.End(); ++testItr) {
|
||||||
@ -187,7 +191,7 @@ protected:
|
|||||||
for (DocumentList::iterator itr = tests.begin(); itr != tests.end(); ++itr)
|
for (DocumentList::iterator itr = tests.begin(); itr != tests.end(); ++itr)
|
||||||
delete *itr;
|
delete *itr;
|
||||||
}
|
}
|
||||||
SchemaDocument* schema;
|
SchemaDocumentType* schema;
|
||||||
DocumentList tests;
|
DocumentList tests;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -199,13 +203,14 @@ TEST_F(Schema, TestSuite) {
|
|||||||
char validatorBuffer[65536];
|
char validatorBuffer[65536];
|
||||||
MemoryPoolAllocator<> validatorAllocator(validatorBuffer, sizeof(validatorBuffer));
|
MemoryPoolAllocator<> validatorAllocator(validatorBuffer, sizeof(validatorBuffer));
|
||||||
|
|
||||||
const int trialCount = 100000;
|
// DCOLES - Reduce number by a factor of 100 to make it more reasonable and inline with other test counts
|
||||||
|
const int trialCount = 1000;
|
||||||
int testCount = 0;
|
int testCount = 0;
|
||||||
clock_t start = clock();
|
clock_t start = clock();
|
||||||
for (int i = 0; i < trialCount; i++) {
|
for (int i = 0; i < trialCount; i++) {
|
||||||
for (TestSuiteList::const_iterator itr = testSuites.begin(); itr != testSuites.end(); ++itr) {
|
for (TestSuiteList::const_iterator itr = testSuites.begin(); itr != testSuites.end(); ++itr) {
|
||||||
const TestSuite& ts = **itr;
|
const TestSuite& ts = **itr;
|
||||||
GenericSchemaValidator<SchemaDocument, BaseReaderHandler<UTF8<> >, MemoryPoolAllocator<> > validator(*ts.schema, &validatorAllocator);
|
GenericSchemaValidator<SchemaDocumentType, BaseReaderHandler<UTF8<> >, MemoryPoolAllocator<> > validator(*ts.schema, &validatorAllocator);
|
||||||
for (DocumentList::const_iterator testItr = ts.tests.begin(); testItr != ts.tests.end(); ++testItr) {
|
for (DocumentList::const_iterator testItr = ts.tests.begin(); testItr != ts.tests.end(); ++testItr) {
|
||||||
validator.Reset();
|
validator.Reset();
|
||||||
(*testItr)->Accept(validator);
|
(*testItr)->Accept(validator);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user