Skip to content

Commit bb2bc98

Browse files
authored
1 parent 43da4f7 commit bb2bc98

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+353
-353
lines changed

benchmark/bench_dom_api.cpp

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ static void recover_one_string(State& state) {
2626
cerr << "could not parse string" << error << endl;
2727
return;
2828
}
29-
for (SIMDJSON_UNUSED auto _ : state) {
29+
for (simdjson_unused auto _ : state) {
3030
std::string_view v;
3131
error = doc.get(v);
3232
if (error) {
@@ -58,7 +58,7 @@ static void serialize_twitter(State& state) {
5858
return;
5959
}
6060
size_t bytes = 0;
61-
for (SIMDJSON_UNUSED auto _ : state) {
61+
for (simdjson_unused auto _ : state) {
6262
std::string serial = simdjson::minify(doc);
6363
bytes += serial.size();
6464
benchmark::DoNotOptimize(serial);
@@ -97,7 +97,7 @@ static void serialize_big_string_to_string(State& state) {
9797
return;
9898
}
9999
size_t bytes = 0;
100-
for (SIMDJSON_UNUSED auto _ : state) {
100+
for (simdjson_unused auto _ : state) {
101101
auto serial = simdjson::to_string(doc);
102102
bytes += serial.size();
103103
benchmark::DoNotOptimize(serial);
@@ -132,7 +132,7 @@ static void serialize_twitter_to_string(State& state) {
132132
return;
133133
}
134134
size_t bytes = 0;
135-
for (SIMDJSON_UNUSED auto _ : state) {
135+
for (simdjson_unused auto _ : state) {
136136
auto serial = simdjson::to_string(doc);
137137
bytes += serial.size();
138138
benchmark::DoNotOptimize(serial);
@@ -175,7 +175,7 @@ static void serialize_twitter_string_builder(State& state) {
175175
}
176176
size_t bytes = 0;
177177
simdjson::internal::string_builder<> sb;// not part of our public API, for internal use
178-
for (SIMDJSON_UNUSED auto _ : state) {
178+
for (simdjson_unused auto _ : state) {
179179
sb.clear();
180180
sb.append(doc);
181181
std::string_view serial = sb.str();
@@ -202,7 +202,7 @@ static void numbers_scan(State& state) {
202202
cerr << "could not read " << NUMBERS_JSON << " as an array: " << error << endl;
203203
return;
204204
}
205-
for (SIMDJSON_UNUSED auto _ : state) {
205+
for (simdjson_unused auto _ : state) {
206206
std::vector<double> container;
207207
for (auto e : arr) {
208208
double x;
@@ -224,7 +224,7 @@ static void numbers_size_scan(State& state) {
224224
cerr << "could not read " << NUMBERS_JSON << " as an array: " << error << endl;
225225
return;
226226
}
227-
for (SIMDJSON_UNUSED auto _ : state) {
227+
for (simdjson_unused auto _ : state) {
228228
std::vector<double> container;
229229
container.resize(arr.size());
230230
size_t pos = 0;
@@ -250,7 +250,7 @@ static void numbers_type_scan(State& state) {
250250
cerr << "could not read " << NUMBERS_JSON << " as an array" << endl;
251251
return;
252252
}
253-
for (SIMDJSON_UNUSED auto _ : state) {
253+
for (simdjson_unused auto _ : state) {
254254
std::vector<double> container;
255255
for (auto e : arr) {
256256
dom::element_type actual_type = e.type();
@@ -276,7 +276,7 @@ static void numbers_type_size_scan(State& state) {
276276
cerr << "could not read " << NUMBERS_JSON << " as an array: " << error << endl;
277277
return;
278278
}
279-
for (SIMDJSON_UNUSED auto _ : state) {
279+
for (simdjson_unused auto _ : state) {
280280
std::vector<double> container;
281281
container.resize(arr.size());
282282
size_t pos = 0;
@@ -301,7 +301,7 @@ static void numbers_load_scan(State& state) {
301301
dom::parser parser;
302302
dom::array arr;
303303
simdjson::error_code error;
304-
for (SIMDJSON_UNUSED auto _ : state) {
304+
for (simdjson_unused auto _ : state) {
305305
// this may hit the disk, but probably just once
306306
if ((error = parser.load(NUMBERS_JSON).get(arr))) {
307307
cerr << "could not read " << NUMBERS_JSON << " as an array: " << error << endl;
@@ -324,7 +324,7 @@ static void numbers_load_size_scan(State& state) {
324324
dom::parser parser;
325325
dom::array arr;
326326
simdjson::error_code error;
327-
for (SIMDJSON_UNUSED auto _ : state) {
327+
for (simdjson_unused auto _ : state) {
328328
// this may hit the disk, but probably just once
329329
if ((error = parser.load(NUMBERS_JSON).get(arr))) {
330330
cerr << "could not read " << NUMBERS_JSON << " as an array" << endl;
@@ -353,7 +353,7 @@ static void numbers_exceptions_scan(State& state) {
353353
// Prints the number of results in twitter.json
354354
dom::parser parser;
355355
dom::array arr = parser.load(NUMBERS_JSON);
356-
for (SIMDJSON_UNUSED auto _ : state) {
356+
for (simdjson_unused auto _ : state) {
357357
std::vector<double> container;
358358
for (double x : arr) {
359359
container.push_back(x);
@@ -368,7 +368,7 @@ static void numbers_exceptions_size_scan(State& state) {
368368
// Prints the number of results in twitter.json
369369
dom::parser parser;
370370
dom::array arr = parser.load(NUMBERS_JSON);
371-
for (SIMDJSON_UNUSED auto _ : state) {
371+
for (simdjson_unused auto _ : state) {
372372
std::vector<double> container;
373373
container.resize(arr.size());
374374
size_t pos = 0;
@@ -388,7 +388,7 @@ static void numbers_type_exceptions_scan(State& state) {
388388
// Prints the number of results in twitter.json
389389
dom::parser parser;
390390
dom::array arr = parser.load(NUMBERS_JSON);
391-
for (SIMDJSON_UNUSED auto _ : state) {
391+
for (simdjson_unused auto _ : state) {
392392
std::vector<double> container;
393393
for (auto e : arr) {
394394
dom::element_type actual_type = e.type();
@@ -407,7 +407,7 @@ static void numbers_type_exceptions_size_scan(State& state) {
407407
// Prints the number of results in twitter.json
408408
dom::parser parser;
409409
dom::array arr = parser.load(NUMBERS_JSON);
410-
for (SIMDJSON_UNUSED auto _ : state) {
410+
for (simdjson_unused auto _ : state) {
411411
std::vector<double> container;
412412
container.resize(arr.size());
413413
size_t pos = 0;
@@ -428,7 +428,7 @@ BENCHMARK(numbers_type_exceptions_size_scan);
428428
static void numbers_exceptions_load_scan(State& state) {
429429
// Prints the number of results in twitter.json
430430
dom::parser parser;
431-
for (SIMDJSON_UNUSED auto _ : state) {
431+
for (simdjson_unused auto _ : state) {
432432
// this may hit the disk, but probably just once
433433
dom::array arr = parser.load(NUMBERS_JSON);
434434
std::vector<double> container;
@@ -444,7 +444,7 @@ BENCHMARK(numbers_exceptions_load_scan);
444444
static void numbers_exceptions_load_size_scan(State& state) {
445445
// Prints the number of results in twitter.json
446446
dom::parser parser;
447-
for (SIMDJSON_UNUSED auto _ : state) {
447+
for (simdjson_unused auto _ : state) {
448448
// this may hit the disk, but probably just once
449449
dom::array arr = parser.load(NUMBERS_JSON);
450450
std::vector<double> container;
@@ -465,7 +465,7 @@ static void twitter_count(State& state) {
465465
// Prints the number of results in twitter.json
466466
dom::parser parser;
467467
dom::element doc = parser.load(TWITTER_JSON);
468-
for (SIMDJSON_UNUSED auto _ : state) {
468+
for (simdjson_unused auto _ : state) {
469469
uint64_t result_count = doc["search_metadata"]["count"];
470470
if (result_count != 100) { return; }
471471
}
@@ -478,7 +478,7 @@ static void iterator_twitter_count(State& state) {
478478
// Prints the number of results in twitter.json
479479
padded_string json = padded_string::load(TWITTER_JSON);
480480
ParsedJson pj = build_parsed_json(json);
481-
for (SIMDJSON_UNUSED auto _ : state) {
481+
for (simdjson_unused auto _ : state) {
482482
ParsedJson::Iterator iter(pj);
483483
// uint64_t result_count = doc["search_metadata"]["count"];
484484
if (!iter.move_to_key("search_metadata")) { return; }
@@ -496,7 +496,7 @@ static void twitter_default_profile(State& state) {
496496
// Count unique users with a default profile.
497497
dom::parser parser;
498498
dom::element doc = parser.load(TWITTER_JSON);
499-
for (SIMDJSON_UNUSED auto _ : state) {
499+
for (simdjson_unused auto _ : state) {
500500
set<string_view> default_users;
501501
for (dom::object tweet : doc["statuses"]) {
502502
dom::object user = tweet["user"];
@@ -514,7 +514,7 @@ static void twitter_image_sizes(State& state) {
514514
dom::parser parser;
515515
dom::element doc = parser.load(TWITTER_JSON);
516516
simdjson::error_code error;
517-
for (SIMDJSON_UNUSED auto _ : state) {
517+
for (simdjson_unused auto _ : state) {
518518
set<tuple<uint64_t, uint64_t>> image_sizes;
519519
for (dom::object tweet : doc["statuses"]) {
520520
dom::array media;
@@ -539,7 +539,7 @@ static void error_code_twitter_count(State& state) noexcept {
539539
simdjson::error_code error;
540540
dom::element doc;
541541
if ((error = parser.load(TWITTER_JSON).get(doc))) { return; }
542-
for (SIMDJSON_UNUSED auto _ : state) {
542+
for (simdjson_unused auto _ : state) {
543543
uint64_t value;
544544
if ((error = doc["search_metadata"]["count"].get(value))) { return; }
545545
if (value != 100) { return; }
@@ -553,7 +553,7 @@ static void error_code_twitter_default_profile(State& state) noexcept {
553553
simdjson::error_code error;
554554
dom::element doc;
555555
if ((error = parser.load(TWITTER_JSON).get(doc))) { std::cerr << error << std::endl; return; }
556-
for (SIMDJSON_UNUSED auto _ : state) {
556+
for (simdjson_unused auto _ : state) {
557557
set<string_view> default_users;
558558

559559
dom::array tweets;
@@ -583,7 +583,7 @@ static void iterator_twitter_default_profile(State& state) {
583583
auto error = padded_string::load(TWITTER_JSON).get(json);
584584
if (error) { std::cerr << error << std::endl; return; }
585585
ParsedJson pj = build_parsed_json(json);
586-
for (SIMDJSON_UNUSED auto _ : state) {
586+
for (simdjson_unused auto _ : state) {
587587
set<string_view> default_users;
588588
ParsedJson::Iterator iter(pj);
589589

@@ -624,7 +624,7 @@ static void error_code_twitter_image_sizes(State& state) noexcept {
624624
simdjson::error_code error;
625625
dom::element doc;
626626
if ((error = parser.load(TWITTER_JSON).get(doc))) { std::cerr << error << std::endl; return; }
627-
for (SIMDJSON_UNUSED auto _ : state) {
627+
for (simdjson_unused auto _ : state) {
628628
set<tuple<uint64_t, uint64_t>> image_sizes;
629629
dom::array statuses;
630630
if ((error = doc["statuses"].get(statuses))) { return; }
@@ -656,7 +656,7 @@ static void iterator_twitter_image_sizes(State& state) {
656656
auto error = padded_string::load(TWITTER_JSON).get(json);
657657
if (error) { std::cerr << error << std::endl; return; }
658658
ParsedJson pj = build_parsed_json(json);
659-
for (SIMDJSON_UNUSED auto _ : state) {
659+
for (simdjson_unused auto _ : state) {
660660
set<tuple<uint64_t, uint64_t>> image_sizes;
661661
ParsedJson::Iterator iter(pj);
662662

@@ -721,7 +721,7 @@ static void print_json(State& state) noexcept {
721721

722722
int code = json_parse(json, parser);
723723
if (code) { cerr << error_message(code) << endl; return; }
724-
for (SIMDJSON_UNUSED auto _ : state) {
724+
for (simdjson_unused auto _ : state) {
725725
std::stringstream s;
726726
if (!parser.print_json(s)) { cerr << "print_json failed" << endl; return; }
727727
}

benchmark/bench_parse_call.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ static void unicode_validate_twitter(State& state) {
2525
return;
2626
}
2727
size_t bytes = 0;
28-
for (SIMDJSON_UNUSED auto _ : state) {
28+
for (simdjson_unused auto _ : state) {
2929
bool is_ok = simdjson::validate_utf8(docdata.data(), docdata.size());
3030
bytes += docdata.size();
3131
benchmark::DoNotOptimize(is_ok);
@@ -55,7 +55,7 @@ static void parse_twitter(State& state) {
5555
return;
5656
}
5757
size_t bytes = 0;
58-
for (SIMDJSON_UNUSED auto _ : state) {
58+
for (simdjson_unused auto _ : state) {
5959
dom::element doc;
6060
bytes += docdata.size();
6161
if ((error = parser.parse(docdata).get(doc))) {
@@ -90,7 +90,7 @@ static void parse_gsoc(State& state) {
9090
return;
9191
}
9292
size_t bytes = 0;
93-
for (SIMDJSON_UNUSED auto _ : state) {
93+
for (simdjson_unused auto _ : state) {
9494
bytes += docdata.size();
9595
dom::element doc;
9696
if ((error = parser.parse(docdata).get(doc))) {
@@ -116,7 +116,7 @@ SIMDJSON_DISABLE_DEPRECATED_WARNING
116116
static void json_parse(State& state) {
117117
ParsedJson pj;
118118
if (!pj.allocate_capacity(EMPTY_ARRAY.length())) { return; }
119-
for (SIMDJSON_UNUSED auto _ : state) {
119+
for (simdjson_unused auto _ : state) {
120120
auto error = json_parse(EMPTY_ARRAY, pj);
121121
if (error) { return; }
122122
}
@@ -126,7 +126,7 @@ BENCHMARK(json_parse);
126126
static void parser_parse_error_code(State& state) {
127127
dom::parser parser;
128128
if (parser.allocate(EMPTY_ARRAY.length())) { return; }
129-
for (SIMDJSON_UNUSED auto _ : state) {
129+
for (simdjson_unused auto _ : state) {
130130
auto error = parser.parse(EMPTY_ARRAY).error();
131131
if (error) { return; }
132132
}
@@ -138,9 +138,9 @@ BENCHMARK(parser_parse_error_code);
138138
static void parser_parse_exception(State& state) {
139139
dom::parser parser;
140140
if (parser.allocate(EMPTY_ARRAY.length())) { return; }
141-
for (SIMDJSON_UNUSED auto _ : state) {
141+
for (simdjson_unused auto _ : state) {
142142
try {
143-
SIMDJSON_UNUSED dom::element doc = parser.parse(EMPTY_ARRAY);
143+
simdjson_unused dom::element doc = parser.parse(EMPTY_ARRAY);
144144
} catch(simdjson_error &j) {
145145
cout << j.what() << endl;
146146
return;
@@ -154,7 +154,7 @@ BENCHMARK(parser_parse_exception);
154154
SIMDJSON_PUSH_DISABLE_WARNINGS
155155
SIMDJSON_DISABLE_DEPRECATED_WARNING
156156
static void build_parsed_json(State& state) {
157-
for (SIMDJSON_UNUSED auto _ : state) {
157+
for (simdjson_unused auto _ : state) {
158158
dom::parser parser = simdjson::build_parsed_json(EMPTY_ARRAY);
159159
if (!parser.valid) { return; }
160160
}
@@ -163,7 +163,7 @@ SIMDJSON_POP_DISABLE_WARNINGS
163163

164164
BENCHMARK(build_parsed_json);
165165
static void document_parse_error_code(State& state) {
166-
for (SIMDJSON_UNUSED auto _ : state) {
166+
for (simdjson_unused auto _ : state) {
167167
dom::parser parser;
168168
auto error = parser.parse(EMPTY_ARRAY).error();
169169
if (error) { return; }
@@ -174,10 +174,10 @@ BENCHMARK(document_parse_error_code);
174174
#if SIMDJSON_EXCEPTIONS
175175

176176
static void document_parse_exception(State& state) {
177-
for (SIMDJSON_UNUSED auto _ : state) {
177+
for (simdjson_unused auto _ : state) {
178178
try {
179179
dom::parser parser;
180-
SIMDJSON_UNUSED dom::element doc = parser.parse(EMPTY_ARRAY);
180+
simdjson_unused dom::element doc = parser.parse(EMPTY_ARRAY);
181181
} catch(simdjson_error &j) {
182182
cout << j.what() << endl;
183183
return;

benchmark/distinctuseridcompetition.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ void simdjson_recurse(std::vector<int64_t> & v, simdjson::dom::object object) {
9898
}
9999
}
100100
simdjson_really_inline void simdjson_recurse(std::vector<int64_t> & v, simdjson::dom::element element) {
101-
SIMDJSON_UNUSED simdjson::error_code error;
101+
simdjson_unused simdjson::error_code error;
102102
simdjson::dom::array array;
103103
simdjson::dom::object object;
104104
if (not (error = element.get(array))) {

benchmark/event_counter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ struct event_collector {
127127
return linux_events.is_working();
128128
}
129129
#else
130-
event_collector(SIMDJSON_UNUSED bool _quiet = false) {}
130+
event_collector(simdjson_unused bool _quiet = false) {}
131131
bool has_events() {
132132
return false;
133133
}

benchmark/json_benchmark.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ template<typename B, typename R> static void JsonBenchmark(benchmark::State &sta
1414
}
1515

1616
// Run the benchmark
17-
for (SIMDJSON_UNUSED auto _ : state) {
17+
for (simdjson_unused auto _ : state) {
1818
collector.start();
1919

2020
if (!bench.Run(json)) { state.SkipWithError("tweet reading failed"); return; }

benchmark/kostya/kostya.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ struct my_point {
6464
simdjson_really_inline bool operator!=(const my_point &other) const { return !(*this == other); }
6565
};
6666

67-
SIMDJSON_UNUSED static std::ostream &operator<<(std::ostream &o, const my_point &p) {
67+
simdjson_unused static std::ostream &operator<<(std::ostream &o, const my_point &p) {
6868
return o << p.x << "," << p.y << "," << p.z << std::endl;
6969
}
7070

benchmark/largerandom/largerandom.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ struct my_point {
4848
simdjson_really_inline bool operator!=(const my_point &other) const { return !(*this == other); }
4949
};
5050

51-
SIMDJSON_UNUSED static std::ostream &operator<<(std::ostream &o, const my_point &p) {
51+
simdjson_unused static std::ostream &operator<<(std::ostream &o, const my_point &p) {
5252
return o << p.x << "," << p.y << "," << p.z << std::endl;
5353
}
5454

benchmark/parsingcompetition.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ using namespace rapidjson;
5656

5757
#ifdef ALLPARSER
5858
// fastjson has a tricky interface
59-
void on_json_error(void *, SIMDJSON_UNUSED const fastjson::ErrorContext &ec) {
59+
void on_json_error(void *, simdjson_unused const fastjson::ErrorContext &ec) {
6060
// std::cerr<<"ERROR: "<<ec.mesg<<std::endl;
6161
}
6262
bool fastjson_parse(const char *input) {

benchmark/partial_tweets/tweet.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ struct tweet {
4242
simdjson_really_inline bool operator!=(const tweet &other) const { return !(*this == other); }
4343
};
4444

45-
SIMDJSON_UNUSED static std::ostream &operator<<(std::ostream &o, const tweet &t) {
45+
simdjson_unused static std::ostream &operator<<(std::ostream &o, const tweet &t) {
4646
o << "created_at: " << t.created_at << std::endl;
4747
o << "id: " << t.id << std::endl;
4848
o << "text: " << t.text << std::endl;

0 commit comments

Comments
 (0)