Skip to content

Commit 8a8eea5

Browse files
authored
Prefixing macros (issue 1035) (simdjson#1124)
* Renaming partially done. * More prefixing. * I thought that this was fixed. * Missed one. * Missed a few. * Missed another one. * Minor fixes.
1 parent 09bd7e8 commit 8a8eea5

98 files changed

Lines changed: 1076 additions & 1076 deletions

File tree

Some content is hidden

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

‎benchmark/bench_dom_api.cpp‎

Lines changed: 24 additions & 24 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 (UNUSED auto _ : state) {
29+
for (SIMDJSON_UNUSED auto _ : state) {
3030
std::string_view v;
3131
error = doc.get(v);
3232
if (error) {
@@ -59,7 +59,7 @@ static void serialize_twitter(State& state) {
5959
return;
6060
}
6161
size_t bytes = 0;
62-
for (UNUSED auto _ : state) {
62+
for (SIMDJSON_UNUSED auto _ : state) {
6363
std::string serial = simdjson::minify(doc);
6464
bytes += serial.size();
6565
benchmark::DoNotOptimize(serial);
@@ -83,7 +83,7 @@ static void numbers_scan(State& state) {
8383
cerr << "could not read " << NUMBERS_JSON << " as an array: " << error << endl;
8484
return;
8585
}
86-
for (UNUSED auto _ : state) {
86+
for (SIMDJSON_UNUSED auto _ : state) {
8787
std::vector<double> container;
8888
for (auto e : arr) {
8989
double x;
@@ -105,7 +105,7 @@ static void numbers_size_scan(State& state) {
105105
cerr << "could not read " << NUMBERS_JSON << " as an array: " << error << endl;
106106
return;
107107
}
108-
for (UNUSED auto _ : state) {
108+
for (SIMDJSON_UNUSED auto _ : state) {
109109
std::vector<double> container;
110110
container.resize(arr.size());
111111
size_t pos = 0;
@@ -131,7 +131,7 @@ static void numbers_type_scan(State& state) {
131131
cerr << "could not read " << NUMBERS_JSON << " as an array" << endl;
132132
return;
133133
}
134-
for (UNUSED auto _ : state) {
134+
for (SIMDJSON_UNUSED auto _ : state) {
135135
std::vector<double> container;
136136
for (auto e : arr) {
137137
dom::element_type actual_type = e.type();
@@ -157,7 +157,7 @@ static void numbers_type_size_scan(State& state) {
157157
cerr << "could not read " << NUMBERS_JSON << " as an array: " << error << endl;
158158
return;
159159
}
160-
for (UNUSED auto _ : state) {
160+
for (SIMDJSON_UNUSED auto _ : state) {
161161
std::vector<double> container;
162162
container.resize(arr.size());
163163
size_t pos = 0;
@@ -182,7 +182,7 @@ static void numbers_load_scan(State& state) {
182182
dom::parser parser;
183183
dom::array arr;
184184
simdjson::error_code error;
185-
for (UNUSED auto _ : state) {
185+
for (SIMDJSON_UNUSED auto _ : state) {
186186
// this may hit the disk, but probably just once
187187
if ((error = parser.load(NUMBERS_JSON).get(arr))) {
188188
cerr << "could not read " << NUMBERS_JSON << " as an array: " << error << endl;
@@ -205,7 +205,7 @@ static void numbers_load_size_scan(State& state) {
205205
dom::parser parser;
206206
dom::array arr;
207207
simdjson::error_code error;
208-
for (UNUSED auto _ : state) {
208+
for (SIMDJSON_UNUSED auto _ : state) {
209209
// this may hit the disk, but probably just once
210210
if ((error = parser.load(NUMBERS_JSON).get(arr))) {
211211
cerr << "could not read " << NUMBERS_JSON << " as an array" << endl;
@@ -234,7 +234,7 @@ static void numbers_exceptions_scan(State& state) {
234234
// Prints the number of results in twitter.json
235235
dom::parser parser;
236236
dom::array arr = parser.load(NUMBERS_JSON);
237-
for (UNUSED auto _ : state) {
237+
for (SIMDJSON_UNUSED auto _ : state) {
238238
std::vector<double> container;
239239
for (double x : arr) {
240240
container.push_back(x);
@@ -249,7 +249,7 @@ static void numbers_exceptions_size_scan(State& state) {
249249
// Prints the number of results in twitter.json
250250
dom::parser parser;
251251
dom::array arr = parser.load(NUMBERS_JSON);
252-
for (UNUSED auto _ : state) {
252+
for (SIMDJSON_UNUSED auto _ : state) {
253253
std::vector<double> container;
254254
container.resize(arr.size());
255255
size_t pos = 0;
@@ -269,7 +269,7 @@ static void numbers_type_exceptions_scan(State& state) {
269269
// Prints the number of results in twitter.json
270270
dom::parser parser;
271271
dom::array arr = parser.load(NUMBERS_JSON);
272-
for (UNUSED auto _ : state) {
272+
for (SIMDJSON_UNUSED auto _ : state) {
273273
std::vector<double> container;
274274
for (auto e : arr) {
275275
dom::element_type actual_type = e.type();
@@ -288,7 +288,7 @@ static void numbers_type_exceptions_size_scan(State& state) {
288288
// Prints the number of results in twitter.json
289289
dom::parser parser;
290290
dom::array arr = parser.load(NUMBERS_JSON);
291-
for (UNUSED auto _ : state) {
291+
for (SIMDJSON_UNUSED auto _ : state) {
292292
std::vector<double> container;
293293
container.resize(arr.size());
294294
size_t pos = 0;
@@ -309,7 +309,7 @@ BENCHMARK(numbers_type_exceptions_size_scan);
309309
static void numbers_exceptions_load_scan(State& state) {
310310
// Prints the number of results in twitter.json
311311
dom::parser parser;
312-
for (UNUSED auto _ : state) {
312+
for (SIMDJSON_UNUSED auto _ : state) {
313313
// this may hit the disk, but probably just once
314314
dom::array arr = parser.load(NUMBERS_JSON);
315315
std::vector<double> container;
@@ -325,7 +325,7 @@ BENCHMARK(numbers_exceptions_load_scan);
325325
static void numbers_exceptions_load_size_scan(State& state) {
326326
// Prints the number of results in twitter.json
327327
dom::parser parser;
328-
for (UNUSED auto _ : state) {
328+
for (SIMDJSON_UNUSED auto _ : state) {
329329
// this may hit the disk, but probably just once
330330
dom::array arr = parser.load(NUMBERS_JSON);
331331
std::vector<double> container;
@@ -346,7 +346,7 @@ static void twitter_count(State& state) {
346346
// Prints the number of results in twitter.json
347347
dom::parser parser;
348348
dom::element doc = parser.load(TWITTER_JSON);
349-
for (UNUSED auto _ : state) {
349+
for (SIMDJSON_UNUSED auto _ : state) {
350350
uint64_t result_count = doc["search_metadata"]["count"];
351351
if (result_count != 100) { return; }
352352
}
@@ -359,7 +359,7 @@ static void iterator_twitter_count(State& state) {
359359
// Prints the number of results in twitter.json
360360
padded_string json = padded_string::load(TWITTER_JSON);
361361
ParsedJson pj = build_parsed_json(json);
362-
for (UNUSED auto _ : state) {
362+
for (SIMDJSON_UNUSED auto _ : state) {
363363
ParsedJson::Iterator iter(pj);
364364
// uint64_t result_count = doc["search_metadata"]["count"];
365365
if (!iter.move_to_key("search_metadata")) { return; }
@@ -377,7 +377,7 @@ static void twitter_default_profile(State& state) {
377377
// Count unique users with a default profile.
378378
dom::parser parser;
379379
dom::element doc = parser.load(TWITTER_JSON);
380-
for (UNUSED auto _ : state) {
380+
for (SIMDJSON_UNUSED auto _ : state) {
381381
set<string_view> default_users;
382382
for (dom::object tweet : doc["statuses"]) {
383383
dom::object user = tweet["user"];
@@ -395,7 +395,7 @@ static void twitter_image_sizes(State& state) {
395395
dom::parser parser;
396396
dom::element doc = parser.load(TWITTER_JSON);
397397
simdjson::error_code error;
398-
for (UNUSED auto _ : state) {
398+
for (SIMDJSON_UNUSED auto _ : state) {
399399
set<tuple<uint64_t, uint64_t>> image_sizes;
400400
for (dom::object tweet : doc["statuses"]) {
401401
dom::array media;
@@ -420,7 +420,7 @@ static void error_code_twitter_count(State& state) noexcept {
420420
simdjson::error_code error;
421421
dom::element doc;
422422
if ((error = parser.load(TWITTER_JSON).get(doc))) { return; }
423-
for (UNUSED auto _ : state) {
423+
for (SIMDJSON_UNUSED auto _ : state) {
424424
uint64_t value;
425425
if ((error = doc["search_metadata"]["count"].get(value))) { return; }
426426
if (value != 100) { return; }
@@ -434,7 +434,7 @@ static void error_code_twitter_default_profile(State& state) noexcept {
434434
simdjson::error_code error;
435435
dom::element doc;
436436
if ((error = parser.load(TWITTER_JSON).get(doc))) { std::cerr << error << std::endl; return; }
437-
for (UNUSED auto _ : state) {
437+
for (SIMDJSON_UNUSED auto _ : state) {
438438
set<string_view> default_users;
439439

440440
dom::array tweets;
@@ -464,7 +464,7 @@ static void iterator_twitter_default_profile(State& state) {
464464
auto error = padded_string::load(TWITTER_JSON).get(json);
465465
if (error) { std::cerr << error << std::endl; return; }
466466
ParsedJson pj = build_parsed_json(json);
467-
for (UNUSED auto _ : state) {
467+
for (SIMDJSON_UNUSED auto _ : state) {
468468
set<string_view> default_users;
469469
ParsedJson::Iterator iter(pj);
470470

@@ -505,7 +505,7 @@ static void error_code_twitter_image_sizes(State& state) noexcept {
505505
simdjson::error_code error;
506506
dom::element doc;
507507
if ((error = parser.load(TWITTER_JSON).get(doc))) { std::cerr << error << std::endl; return; }
508-
for (UNUSED auto _ : state) {
508+
for (SIMDJSON_UNUSED auto _ : state) {
509509
set<tuple<uint64_t, uint64_t>> image_sizes;
510510
dom::array statuses;
511511
if ((error = doc["statuses"].get(statuses))) { return; }
@@ -537,7 +537,7 @@ static void iterator_twitter_image_sizes(State& state) {
537537
auto error = padded_string::load(TWITTER_JSON).get(json);
538538
if (error) { std::cerr << error << std::endl; return; }
539539
ParsedJson pj = build_parsed_json(json);
540-
for (UNUSED auto _ : state) {
540+
for (SIMDJSON_UNUSED auto _ : state) {
541541
set<tuple<uint64_t, uint64_t>> image_sizes;
542542
ParsedJson::Iterator iter(pj);
543543

@@ -602,7 +602,7 @@ static void print_json(State& state) noexcept {
602602

603603
int code = json_parse(json, parser);
604604
if (code) { cerr << error_message(code) << endl; return; }
605-
for (UNUSED auto _ : state) {
605+
for (SIMDJSON_UNUSED auto _ : state) {
606606
std::stringstream s;
607607
if (!parser.print_json(s)) { cerr << "print_json failed" << endl; return; }
608608
}

‎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 (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 (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 (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 (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 (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 (UNUSED auto _ : state) {
141+
for (SIMDJSON_UNUSED auto _ : state) {
142142
try {
143-
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 (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 (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 (UNUSED auto _ : state) {
177+
for (SIMDJSON_UNUSED auto _ : state) {
178178
try {
179179
dom::parser parser;
180-
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/benchfeatures.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ struct feature_benchmarker {
158158

159159
}
160160

161-
really_inline void run_iterations(size_t iterations, bool stage1_only=false) {
161+
simdjson_really_inline void run_iterations(size_t iterations, bool stage1_only=false) {
162162
struct7.run_iterations(iterations, stage1_only);
163163
struct7_miss.run_iterations(iterations, stage1_only);
164164
struct7_full.run_iterations(iterations, stage1_only);

‎benchmark/benchmarker.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ struct benchmarker {
308308
return all_stages_without_allocation.iterations;
309309
}
310310

311-
really_inline void run_iteration(bool stage1_only, bool hotbuffers=false) {
311+
simdjson_really_inline void run_iteration(bool stage1_only, bool hotbuffers=false) {
312312
// Allocate dom::parser
313313
collector.start();
314314
dom::parser parser;
@@ -384,7 +384,7 @@ struct benchmarker {
384384
loop << all_loop_count;
385385
}
386386

387-
really_inline void run_iterations(size_t iterations, bool stage1_only, bool hotbuffers=false) {
387+
simdjson_really_inline void run_iterations(size_t iterations, bool stage1_only, bool hotbuffers=false) {
388388
for (size_t i = 0; i<iterations; i++) {
389389
run_iteration(stage1_only, hotbuffers);
390390
}

0 commit comments

Comments
 (0)