Skip to content

Commit f6ff280

Browse files
committed
[perf] some startup tweaks
1 parent 6d55315 commit f6ff280

13 files changed

Lines changed: 176 additions & 161 deletions

.github/workflows/bins.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,8 @@ jobs:
313313
env:
314314
# select release-signing policy for main and release branches
315315
SIGNPATH_SIGNING_POLICY_SLUG: |
316-
${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/'))
317-
&& 'test-signing'
316+
${{ (startsWith(github.ref, 'refs/heads/release/'))
317+
&& 'release-signing'
318318
|| 'test-signing' }}
319319
with:
320320
api-token: '${{ secrets.SIGNPATH_API_TOKEN }}'

src/bottom_status_source.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ bottom_status_source::bottom_status_source()
4545
this->bss_fields[BSF_LOADING].set_width(13);
4646
this->bss_fields[BSF_LOADING].right_justify(true);
4747
this->bss_fields[BSF_HELP].set_width(14);
48-
this->bss_fields[BSF_HELP].set_value("?:View Help");
48+
this->bss_fields[BSF_HELP].set_value("?:View Help"_frag);
4949
this->bss_fields[BSF_HELP].right_justify(true);
5050
this->bss_prompt.set_left_pad(1);
5151
this->bss_prompt.set_min_width(35);
@@ -65,11 +65,11 @@ bottom_status_source::update_line_number(listview_curses* lc)
6565
auto sel = lc->get_selection();
6666

6767
if (lc->get_inner_height() == 0) {
68-
sf.set_value(" L0");
68+
sf.set_value(" L0"_frag);
6969
} else if (sel) {
7070
sf.set_value(" L%'d", (int) sel.value());
7171
} else {
72-
sf.set_value(" L-");
72+
sf.set_value(" L-"_frag);
7373
}
7474

7575
this->bss_line_error.set_value(
@@ -199,7 +199,7 @@ bottom_status_source::update_loading(file_off_t off,
199199
sf.set_cylon(false);
200200
sf.set_role(role_t::VCR_STATUS);
201201
if (this->bss_paused) {
202-
sf.set_value("\xE2\x80\x96 Paused");
202+
sf.set_value("\xE2\x80\x96 Paused"_frag);
203203
} else {
204204
sf.clear();
205205
}

src/cmds.io.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1215,7 +1215,7 @@ com_open(exec_context& ec, std::string cmdline, std::vector<std::string>& args)
12151215
}
12161216
lnav_data.ld_preview_status_source[0]
12171217
.get_description()
1218-
.set_value("The following files will be loaded:");
1218+
.set_value("The following files will be loaded:"_frag);
12191219
lnav_data.ld_status[LNS_PREVIEW0].set_needs_update();
12201220
lnav_data.ld_preview_view[0].set_sub_source(
12211221
&lnav_data.ld_preview_source[0]);

src/doc_status_source.hh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public:
6464
return this->tss_fields[field];
6565
}
6666

67-
void set_title(const std::string& title)
67+
void set_title(const string_fragment& title)
6868
{
6969
this->tss_fields[TSF_TITLE].set_value(title);
7070
}

src/filter_status_source.cc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
#include "filter_sub_source.hh"
3737
#include "lnav.hh"
3838

39-
static constexpr auto TOGGLE_MSG = "Press " ANSI_BOLD("TAB") " to edit ";
40-
static constexpr auto EXIT_MSG = "Press " ANSI_BOLD("ESC") " to exit ";
39+
static constexpr auto TOGGLE_MSG = "Press " ANSI_BOLD("TAB") " to edit "_frag;
40+
static constexpr auto EXIT_MSG = "Press " ANSI_BOLD("ESC") " to exit "_frag;
4141

4242
static constexpr auto CREATE_HELP
4343
= ANSI_BOLD("i") "/" ANSI_BOLD("o") ": Create in/out";
@@ -141,7 +141,8 @@ filter_status_source::statusview_fields()
141141

142142
auto& fc = lnav_data.ld_active_files;
143143
if (fc.fc_name_to_errors->readAccess()->size() == 1) {
144-
this->tss_error.set_value(" error: a file cannot be opened ");
144+
this->tss_error.set_value(
145+
" error: a file cannot be opened "_frag);
145146
} else {
146147
this->tss_error.set_value(
147148
" error: %u files cannot be opened ",
@@ -176,7 +177,7 @@ filter_status_source::statusview_fields()
176177
filter_count += 1;
177178
}
178179
if (filter_count == 0) {
179-
this->tss_fields[TSF_COUNT].set_value("");
180+
this->tss_fields[TSF_COUNT].set_value(""_frag);
180181
} else {
181182
this->tss_fields[TSF_COUNT].set_value(
182183
" " ANSI_BOLD("%d") " of " ANSI_BOLD("%d") " enabled ",

src/lnav.indexing.cc

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ using namespace lnav::roles::literals;
4747
*/
4848
class loading_observer : public logfile_observer {
4949
public:
50-
loading_observer() : lo_last_offset(0) {}
51-
5250
lnav::progress_result_t logfile_indexing(const logfile* lf,
5351
file_off_t off,
5452
file_ssize_t total) override
@@ -90,7 +88,7 @@ class loading_observer : public logfile_observer {
9088
return retval;
9189
}
9290

93-
off_t lo_last_offset;
91+
off_t lo_last_offset{0};
9492
};
9593

9694
lnav::progress_result_t
@@ -119,9 +117,9 @@ do_observer_update(const logfile* lf)
119117
void
120118
rebuild_hist()
121119
{
122-
logfile_sub_source& lss = lnav_data.ld_log_source;
123-
hist_source2& hs = lnav_data.ld_hist_source2;
124-
int zoom = lnav_data.ld_zoom_level;
120+
auto& lss = lnav_data.ld_log_source;
121+
auto& hs = lnav_data.ld_hist_source2;
122+
const auto zoom = lnav_data.ld_zoom_level;
125123

126124
hs.set_time_slice(ZOOM_LEVELS[zoom]);
127125
lss.reload_index_delegate();

src/lnav_commands.cc

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,7 +1091,7 @@ com_mark_expr(exec_context& ec,
10911091
return Err(set_res.unwrapErr());
10921092
}
10931093
lnav_data.ld_preview_status_source[0].get_description().set_value(
1094-
"Matches are highlighted in the text view");
1094+
"Matches are highlighted in the text view"_frag);
10951095
lnav_data.ld_status[LNS_PREVIEW0].set_needs_update();
10961096
} else {
10971097
auto set_res = lss.set_sql_marker(expr, stmt.release());
@@ -1263,7 +1263,7 @@ com_highlight(exec_context& ec,
12631263
hm[{highlight_source_t::PREVIEW, "preview"}] = hl;
12641264

12651265
lnav_data.ld_preview_status_source[0].get_description().set_value(
1266-
"Matches are highlighted in the view");
1266+
"Matches are highlighted in the view"_frag);
12671267
lnav_data.ld_status[LNS_PREVIEW0].set_needs_update();
12681268

12691269
retval = "";
@@ -1395,7 +1395,7 @@ com_filter_expr(exec_context& ec,
13951395
return Err(set_res.unwrapErr());
13961396
}
13971397
lnav_data.ld_preview_status_source[0].get_description().set_value(
1398-
"Matches are highlighted in the text view");
1398+
"Matches are highlighted in the text view"_frag);
13991399
lnav_data.ld_status[LNS_PREVIEW0].set_needs_update();
14001400
} else {
14011401
lnav_data.ld_log_source.set_preview_sql_filter(nullptr);
@@ -1508,7 +1508,7 @@ com_create_logline_table(exec_context& ec,
15081508
attr_line_t al(ldt->get_table_statement());
15091509

15101510
lnav_data.ld_preview_status_source[0].get_description().set_value(
1511-
"The following table will be created:");
1511+
"The following table will be created:"_frag);
15121512
lnav_data.ld_status[LNS_PREVIEW0].set_needs_update();
15131513
lnav_data.ld_preview_view[0].set_sub_source(
15141514
&lnav_data.ld_preview_source[0]);
@@ -1622,7 +1622,7 @@ com_create_search_table(exec_context& ec,
16221622
attr_line_t al(lst->get_table_statement());
16231623

16241624
lnav_data.ld_preview_status_source[0].get_description().set_value(
1625-
"The following table will be created:");
1625+
"The following table will be created:"_frag);
16261626
lnav_data.ld_status[LNS_PREVIEW0].set_needs_update();
16271627

16281628
lnav_data.ld_preview_view[0].set_sub_source(
@@ -1914,7 +1914,7 @@ com_comment(exec_context& ec,
19141914
auto al = parse_res.unwrap();
19151915
lnav_data.ld_preview_status_source[0]
19161916
.get_description()
1917-
.set_value("Comment rendered as markdown:");
1917+
.set_value("Comment rendered as markdown:"_frag);
19181918
lnav_data.ld_status[LNS_PREVIEW0].set_needs_update();
19191919
lnav_data.ld_preview_view[0].set_sub_source(
19201920
&lnav_data.ld_preview_source[0]);
@@ -3085,7 +3085,7 @@ com_echo(exec_context& ec, std::string cmdline, std::vector<std::string>& args)
30853085
auto ec_out = ec.get_output();
30863086
if (ec.ec_dry_run) {
30873087
lnav_data.ld_preview_status_source[0].get_description().set_value(
3088-
"The text to output:");
3088+
"The text to output:"_frag);
30893089
lnav_data.ld_status[LNS_PREVIEW0].set_needs_update();
30903090
lnav_data.ld_preview_view[0].set_sub_source(
30913091
&lnav_data.ld_preview_source[0]);
@@ -3166,7 +3166,7 @@ com_eval(exec_context& ec, std::string cmdline, std::vector<std::string>& args)
31663166
attr_line_t al(expanded_cmd);
31673167

31683168
lnav_data.ld_preview_status_source[0].get_description().set_value(
3169-
"The command to be executed:");
3169+
"The command to be executed:"_frag);
31703170
lnav_data.ld_status[LNS_PREVIEW0].set_needs_update();
31713171

31723172
lnav_data.ld_preview_view[0].set_sub_source(
@@ -3560,7 +3560,7 @@ command_prompt(std::vector<std::string>& args)
35603560
auto* tc = *lnav_data.ld_view_stack.top();
35613561

35623562
rollback_lnav_config = lnav_config;
3563-
lnav_data.ld_doc_status_source.set_title("Command Help");
3563+
lnav_data.ld_doc_status_source.set_title("Command Help"_frag);
35643564
lnav_data.ld_doc_status_source.set_description(
35653565
" See " ANSI_BOLD("https://docs.lnav.org/en/latest/"
35663566
"commands.html") " for more details");
@@ -3600,7 +3600,7 @@ search_prompt(std::vector<std::string>& args)
36003600
lnav_data.ld_exec_context.ec_top_line = tc->get_selection().value_or(0_vl);
36013601
lnav_data.ld_search_start_line = tc->get_selection().value_or(0_vl);
36023602
prompt.focus_for(*tc, '/', args);
3603-
lnav_data.ld_doc_status_source.set_title("Syntax Help");
3603+
lnav_data.ld_doc_status_source.set_title("Syntax Help"_frag);
36043604
lnav_data.ld_doc_status_source.set_description("");
36053605
rl_set_help();
36063606
lnav_data.ld_bottom_source.set_prompt(
@@ -3671,7 +3671,7 @@ sql_prompt(std::vector<std::string>& args)
36713671
setup_logline_table(lnav_data.ld_exec_context);
36723672
prompt.focus_for(*tc, ';', args);
36733673

3674-
lnav_data.ld_doc_status_source.set_title("Query Help");
3674+
lnav_data.ld_doc_status_source.set_title("Query Help"_frag);
36753675
lnav_data.ld_doc_status_source.set_description(
36763676
"See " ANSI_BOLD("https://docs.lnav.org/en/latest/"
36773677
"sqlext.html") " for more details");

src/log.annotate.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ struct compiled_cond_expr {
5050
bool cce_enabled{true};
5151
};
5252

53-
struct expressions : public lnav_config_listener {
53+
struct expressions : lnav_config_listener {
5454
expressions() : lnav_config_listener(__FILE__) {}
5555

5656
void reload_config(error_reporter& reporter) override

src/log.annotate.hh

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,20 @@
3030
#ifndef lnav_log_annotate_hh
3131
#define lnav_log_annotate_hh
3232

33+
#include <vector>
34+
3335
#include "base/intern_string.hh"
3436
#include "base/lnav.console.hh"
3537
#include "base/result.h"
3638
#include "vis_line.hh"
3739

38-
namespace lnav {
39-
namespace log {
40-
namespace annotate {
40+
namespace lnav::log::annotate {
4141

4242
std::vector<intern_string_t> applicable(vis_line_t vl);
4343

4444
Result<void, lnav::console::user_message> apply(
4545
vis_line_t vl, std::vector<intern_string_t> annos);
4646

47-
} // namespace annotate
48-
} // namespace log
49-
} // namespace lnav
47+
} // namespace lnav::log::annotate
5048

5149
#endif

0 commit comments

Comments
 (0)