Added std::minify

This commit is contained in:
Daniel Lemire 2020-06-12 16:37:41 -04:00
parent be707dbb6f
commit 1b6258ec8c
1 changed files with 13 additions and 0 deletions

View File

@ -45,6 +45,14 @@ std::string rapid_stringme(char *json) {
return buffer.GetString();
}
std::string simdjson_stringme(simdjson::padded_string & json) {
std::stringstream ss;
dom::parser parser;
dom::element doc = parser.parse(json);
ss << simdjson::minify(doc);
return ss.str();
}
int main(int argc, char *argv[]) {
int c;
@ -103,6 +111,11 @@ int main(int argc, char *argv[]) {
BEST_TIME_NOCHECK(
"despacing with RapidJSON Insitu", rapid_stringme_insitu((char *)buffer),
memcpy(buffer, p.data(), p.size()), repeat, volume, !just_data);
BEST_TIME_NOCHECK(
"despacing with std::minify", simdjson_stringme(p),, repeat, volume, !just_data);
memcpy(buffer, p.data(), p.size());
size_t outlength;
uint8_t *cbuffer = (uint8_t *)buffer;