From 1b6258ec8c814aaadec5aa253dc4b7e7615da46f Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Fri, 12 Jun 2020 16:37:41 -0400 Subject: [PATCH] Added std::minify --- benchmark/minifiercompetition.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/benchmark/minifiercompetition.cpp b/benchmark/minifiercompetition.cpp index 6028c0d4..189979dd 100644 --- a/benchmark/minifiercompetition.cpp +++ b/benchmark/minifiercompetition.cpp @@ -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;