Substitute spaces for tabs
This commit is contained in:
parent
2346239887
commit
01333964bd
1 changed files with 17 additions and 18 deletions
|
|
@ -35,7 +35,6 @@ HBenchmarkResults *h_benchmark(HParser* parser, HParserTestcase* testcases) {
|
||||||
return h_benchmark__m(&system_allocator, parser, testcases);
|
return h_benchmark__m(&system_allocator, parser, testcases);
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO(uucidl): replace tabs with the right number of spaces
|
|
||||||
HBenchmarkResults *h_benchmark__m(HAllocator* mm__, HParser* parser, HParserTestcase* testcases) {
|
HBenchmarkResults *h_benchmark__m(HAllocator* mm__, HParser* parser, HParserTestcase* testcases) {
|
||||||
// For now, just output the results to stderr
|
// For now, just output the results to stderr
|
||||||
HParserTestcase* tc = testcases;
|
HParserTestcase* tc = testcases;
|
||||||
|
|
@ -67,18 +66,18 @@ HBenchmarkResults *h_benchmark__m(HAllocator* mm__, HParser* parser, HParserTest
|
||||||
HParseResult *res = h_parse(parser, tc->input, tc->length);
|
HParseResult *res = h_parse(parser, tc->input, tc->length);
|
||||||
char* res_unamb;
|
char* res_unamb;
|
||||||
if (res != NULL) {
|
if (res != NULL) {
|
||||||
res_unamb = h_write_result_unamb(res->ast);
|
res_unamb = h_write_result_unamb(res->ast);
|
||||||
} else
|
} else
|
||||||
res_unamb = NULL;
|
res_unamb = NULL;
|
||||||
if ((res_unamb == NULL && tc->output_unambiguous != NULL)
|
if ((res_unamb == NULL && tc->output_unambiguous != NULL)
|
||||||
|| (res_unamb != NULL && strcmp(res_unamb, tc->output_unambiguous) != 0)) {
|
|| (res_unamb != NULL && strcmp(res_unamb, tc->output_unambiguous) != 0)) {
|
||||||
// test case failed...
|
// test case failed...
|
||||||
fprintf(stderr, "Parsing with %s failed\n", HParserBackendNames[backend]);
|
fprintf(stderr, "Parsing with %s failed\n", HParserBackendNames[backend]);
|
||||||
// We want to run all testcases, for purposes of generating a
|
// We want to run all testcases, for purposes of generating a
|
||||||
// report. (eg, if users are trying to fix a grammar for a
|
// report. (eg, if users are trying to fix a grammar for a
|
||||||
// faster backend)
|
// faster backend)
|
||||||
tc_failed++;
|
tc_failed++;
|
||||||
ret->results[backend].failed_testcases++;
|
ret->results[backend].failed_testcases++;
|
||||||
}
|
}
|
||||||
h_parse_result_free(res);
|
h_parse_result_free(res);
|
||||||
(&system_allocator)->free(&system_allocator, res_unamb);
|
(&system_allocator)->free(&system_allocator, res_unamb);
|
||||||
|
|
@ -98,13 +97,13 @@ HBenchmarkResults *h_benchmark__m(HAllocator* mm__, HParser* parser, HParserTest
|
||||||
int count = 1, cur;
|
int count = 1, cur;
|
||||||
int64_t time_diff;
|
int64_t time_diff;
|
||||||
do {
|
do {
|
||||||
count *= 2; // Yes, this means that the first run will run the function twice. This is fine, as we want multiple runs anyway.
|
count *= 2; // Yes, this means that the first run will run the function twice. This is fine, as we want multiple runs anyway.
|
||||||
struct HStopWatch stopwatch;
|
struct HStopWatch stopwatch;
|
||||||
h_platform_stopwatch_reset(&stopwatch);
|
h_platform_stopwatch_reset(&stopwatch);
|
||||||
for (cur = 0; cur < count; cur++) {
|
for (cur = 0; cur < count; cur++) {
|
||||||
h_parse_result_free(h_parse(parser, tc->input, tc->length));
|
h_parse_result_free(h_parse(parser, tc->input, tc->length));
|
||||||
}
|
}
|
||||||
time_diff = h_platform_stopwatch_ns(&stopwatch);
|
time_diff = h_platform_stopwatch_ns(&stopwatch);
|
||||||
} while (time_diff < 100000000);
|
} while (time_diff < 100000000);
|
||||||
ret->results[backend].cases[cur_case].parse_time = (time_diff / count);
|
ret->results[backend].cases[cur_case].parse_time = (time_diff / count);
|
||||||
ret->results[backend].cases[cur_case].length = tc->length;
|
ret->results[backend].cases[cur_case].length = tc->length;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue