@@ -365,7 +365,8 @@ BENCHMARK(twitter_image_sizes);
365365static void error_code_twitter_count (State& state) noexcept {
366366 // Prints the number of results in twitter.json
367367 dom::parser parser;
368- dom::element doc = parser.load (TWITTER_JSON );
368+ auto [doc, error1] = parser.load (TWITTER_JSON );
369+ if (error1) { return ; }
369370 for (UNUSED auto _ : state) {
370371 auto [value, error] = doc[" search_metadata" ][" count" ].get <uint64_t >();
371372 if (error) { return ; }
@@ -377,7 +378,8 @@ BENCHMARK(error_code_twitter_count);
377378static void error_code_twitter_default_profile (State& state) noexcept {
378379 // Count unique users with a default profile.
379380 dom::parser parser;
380- dom::element doc = parser.load (TWITTER_JSON );
381+ auto [doc, error1] = parser.load (TWITTER_JSON );
382+ if (error1) { std::cerr << error1 << std::endl; return ; }
381383 for (UNUSED auto _ : state) {
382384 set<string_view> default_users;
383385
@@ -404,7 +406,8 @@ SIMDJSON_PUSH_DISABLE_WARNINGS
404406SIMDJSON_DISABLE_DEPRECATED_WARNING
405407static void iterator_twitter_default_profile (State& state) {
406408 // Count unique users with a default profile.
407- padded_string json = padded_string::load (TWITTER_JSON );
409+ auto [json, error1] = padded_string::load (TWITTER_JSON );
410+ if (error1) { std::cerr << error1 << std::endl; return ; }
408411 ParsedJson pj = build_parsed_json (json);
409412 for (UNUSED auto _ : state) {
410413 set<string_view> default_users;
@@ -444,7 +447,8 @@ BENCHMARK(iterator_twitter_default_profile);
444447static void error_code_twitter_image_sizes (State& state) noexcept {
445448 // Count unique image sizes
446449 dom::parser parser;
447- dom::element doc = parser.load (TWITTER_JSON );
450+ auto [doc, error1] = parser.load (TWITTER_JSON );
451+ if (error1) { std::cerr << error1 << std::endl; return ; }
448452 for (UNUSED auto _ : state) {
449453 set<tuple<uint64_t , uint64_t >> image_sizes;
450454 auto [statuses, error] = doc[" statuses" ].get <dom::array>();
@@ -473,7 +477,8 @@ SIMDJSON_PUSH_DISABLE_WARNINGS
473477SIMDJSON_DISABLE_DEPRECATED_WARNING
474478static void iterator_twitter_image_sizes (State& state) {
475479 // Count unique image sizes
476- padded_string json = padded_string::load (TWITTER_JSON );
480+ auto [json, error1] = padded_string::load (TWITTER_JSON );
481+ if (error1) { std::cerr << error1 << std::endl; return ; }
477482 ParsedJson pj = build_parsed_json (json);
478483 for (UNUSED auto _ : state) {
479484 set<tuple<uint64_t , uint64_t >> image_sizes;
@@ -531,7 +536,8 @@ BENCHMARK(iterator_twitter_image_sizes);
531536
532537static void print_json (State& state) noexcept {
533538 // Prints the number of results in twitter.json
534- padded_string json = get_corpus (TWITTER_JSON );
539+ auto [json, error1] = padded_string::load (TWITTER_JSON );
540+ if (error1) { std::cerr << error1 << std::endl; return ; }
535541 dom::parser parser;
536542 if (int error = json_parse (json, parser); error != SUCCESS ) { cerr << error_message (error) << endl; return ; }
537543 for (UNUSED auto _ : state) {
0 commit comments