Adding stringify.
This commit is contained in:
parent
fd56854c3f
commit
5ccd5f6b4e
|
@ -13,6 +13,15 @@
|
||||||
using namespace rapidjson;
|
using namespace rapidjson;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
std::string rapidstringme(char * json) {
|
||||||
|
Document d;
|
||||||
|
d.Parse(json);
|
||||||
|
StringBuffer buffer;
|
||||||
|
Writer<StringBuffer> writer(buffer);
|
||||||
|
d.Accept(writer);
|
||||||
|
return buffer.GetString();
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
cerr << "Usage: " << argv[0] << " <jsonfile>\n";
|
cerr << "Usage: " << argv[0] << " <jsonfile>\n";
|
||||||
|
@ -75,4 +84,8 @@ int main(int argc, char *argv[]) {
|
||||||
memcpy(buffer, p.first, p.second), repeat, volume, true);
|
memcpy(buffer, p.first, p.second), repeat, volume, true);
|
||||||
BEST_TIME(d.ParseInsitu(buffer).HasParseError(), false,
|
BEST_TIME(d.ParseInsitu(buffer).HasParseError(), false,
|
||||||
memcpy(buffer, p.first, p.second), repeat, volume, true);
|
memcpy(buffer, p.first, p.second), repeat, volume, true);
|
||||||
|
size_t strlength = rapidstringme((char*) p.first).size();
|
||||||
|
std::cout << "input length is "<< p.second << " stringified length is " << strlength << std::endl;
|
||||||
|
BEST_TIME_NOCHECK(rapidstringme((char*) p.first), , repeat, volume,
|
||||||
|
true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,7 @@ uint64_t global_rdtsc_overhead = (uint64_t)UINT64_MAX;
|
||||||
RDTSC_SET_OVERHEAD(rdtsc_overhead_func(1), repeat); \
|
RDTSC_SET_OVERHEAD(rdtsc_overhead_func(1), repeat); \
|
||||||
} \
|
} \
|
||||||
if (verbose) \
|
if (verbose) \
|
||||||
printf("%-60s\t: ", #test); \
|
printf("%-40s\t: ", #test); \
|
||||||
fflush(NULL); \
|
fflush(NULL); \
|
||||||
uint64_t cycles_start, cycles_final, cycles_diff; \
|
uint64_t cycles_start, cycles_final, cycles_diff; \
|
||||||
uint64_t min_diff = (uint64_t)-1; \
|
uint64_t min_diff = (uint64_t)-1; \
|
||||||
|
|
Loading…
Reference in New Issue