@@ -13,11 +13,11 @@ namespace quick_lint_js {
1313namespace {
1414void benchmark_location_scale_of_long_line (::benchmark::State &state) {
1515 int line_length = 10'000 ;
16- padded_string line (string8 (narrow_cast<std::size_t >(line_length), u8 ' x' ));
16+ Padded_String line (String8 (narrow_cast<std::size_t >(line_length), u8 ' x' ));
1717 for (auto _ : state) {
18- lsp_locator l (&line);
18+ LSP_Locator l (&line);
1919 for (int i = 0 ; i < line_length; ++i) {
20- lsp_position p = l.position (&line[i]);
20+ LSP_Position p = l.position (&line[i]);
2121 ::benchmark::DoNotOptimize (p);
2222 }
2323 }
@@ -26,11 +26,11 @@ BENCHMARK(benchmark_location_scale_of_long_line);
2626
2727void benchmark_from_position_scale_of_long_line (::benchmark::State &state) {
2828 int line_length = 10'000 ;
29- padded_string line (string8 (narrow_cast<std::size_t >(line_length), u8 ' x' ));
29+ Padded_String line (String8 (narrow_cast<std::size_t >(line_length), u8 ' x' ));
3030 for (auto _ : state) {
31- lsp_locator l (&line);
31+ LSP_Locator l (&line);
3232 for (int i = 0 ; i < line_length; ++i) {
33- const char8 *c = l.from_position (lsp_position {.line = 0 , .character = i});
33+ const Char8 *c = l.from_position (LSP_Position {.line = 0 , .character = i});
3434 ::benchmark::DoNotOptimize (c);
3535 }
3636 }
@@ -39,11 +39,11 @@ BENCHMARK(benchmark_from_position_scale_of_long_line);
3939
4040void benchmark_location_scale_of_empty_lines (::benchmark::State &state) {
4141 int line_count = 10'000 ;
42- padded_string lines (string8 (narrow_cast<std::size_t >(line_count), u8 ' \n ' ));
42+ Padded_String lines (String8 (narrow_cast<std::size_t >(line_count), u8 ' \n ' ));
4343 for (auto _ : state) {
44- lsp_locator l (&lines);
44+ LSP_Locator l (&lines);
4545 for (int i = 0 ; i < line_count; ++i) {
46- lsp_position p = l.position (&lines[i]);
46+ LSP_Position p = l.position (&lines[i]);
4747 ::benchmark::DoNotOptimize (p);
4848 }
4949 }
@@ -52,11 +52,11 @@ BENCHMARK(benchmark_location_scale_of_empty_lines);
5252
5353void benchmark_from_position_scale_of_empty_lines (::benchmark::State &state) {
5454 int line_count = 10'000 ;
55- padded_string lines (string8 (narrow_cast<std::size_t >(line_count), u8 ' \n ' ));
55+ Padded_String lines (String8 (narrow_cast<std::size_t >(line_count), u8 ' \n ' ));
5656 for (auto _ : state) {
57- lsp_locator l (&lines);
57+ LSP_Locator l (&lines);
5858 for (int i = 0 ; i < line_count; ++i) {
59- const char8 *c = l.from_position ({.line = i, .character = 0 });
59+ const Char8 *c = l.from_position ({.line = i, .character = 0 });
6060 ::benchmark::DoNotOptimize (c);
6161 }
6262 }
@@ -66,12 +66,12 @@ BENCHMARK(benchmark_from_position_scale_of_empty_lines);
6666void benchmark_range_scale_of_empty_lines (::benchmark::State &state) {
6767 int line_length = 10'000 ;
6868 int span_length = 5 ;
69- padded_string line (string8 (narrow_cast<std::size_t >(line_length), u8 ' \n ' ));
69+ Padded_String line (String8 (narrow_cast<std::size_t >(line_length), u8 ' \n ' ));
7070 for (auto _ : state) {
71- lsp_locator l (&line);
71+ LSP_Locator l (&line);
7272 for (int i = 0 ; i < line_length - span_length; i += span_length) {
73- source_code_span span (&line[i], &line[i + span_length]);
74- lsp_range r = l.range (span);
73+ Source_Code_Span span (&line[i], &line[i + span_length]);
74+ LSP_Range r = l.range (span);
7575 ::benchmark::DoNotOptimize (r);
7676 }
7777 }
@@ -85,9 +85,9 @@ void benchmark_location_realisticish(::benchmark::State &state) {
8585 /* line_count=*/ line_count, /* span_count=*/ span_count);
8686
8787 for (auto _ : state) {
88- lsp_locator l (code.source .get ());
89- for (const source_code_span &span : code.spans ) {
90- lsp_range r = l.range (span);
88+ LSP_Locator l (code.source .get ());
89+ for (const Source_Code_Span &span : code.spans ) {
90+ LSP_Range r = l.range (span);
9191 ::benchmark::DoNotOptimize (r);
9292 }
9393 }
@@ -100,20 +100,20 @@ void benchmark_from_position_realisticish(::benchmark::State &state) {
100100 source_code_with_spans code = make_realisticish_code (
101101 /* line_count=*/ line_count, /* span_count=*/ span_count);
102102
103- std::vector<lsp_position > positions;
103+ std::vector<LSP_Position > positions;
104104 {
105- lsp_locator l (code.source .get ());
106- for (const source_code_span &span : code.spans ) {
107- lsp_range r = l.range (span);
105+ LSP_Locator l (code.source .get ());
106+ for (const Source_Code_Span &span : code.spans ) {
107+ LSP_Range r = l.range (span);
108108 positions.push_back (r.start );
109109 positions.push_back (r.end );
110110 }
111111 }
112112
113113 for (auto _ : state) {
114- lsp_locator l (code.source .get ());
115- for (const lsp_position &position : positions) {
116- const char8 *c = l.from_position (position);
114+ LSP_Locator l (code.source .get ());
115+ for (const LSP_Position &position : positions) {
116+ const Char8 *c = l.from_position (position);
117117 ::benchmark::DoNotOptimize (c);
118118 }
119119 }
0 commit comments