Skip to content

Commit

Permalink
Merge pull request #38 from Propfend/opt
Browse files Browse the repository at this point in the history
`codegen-units = 1` for better runtime performance
  • Loading branch information
mcharytoniuk authored Jan 10, 2025
2 parents eaa2d84 + 3dbadef commit 9eb79e3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 21 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,4 @@ web_dashboard = ["dep:askama", "dep:askama_actix", "dep:mime_guess", "dep:rust-e

[profile.release]
lto = true
codegen-units = 1
32 changes: 11 additions & 21 deletions src/cmd/dashboard/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use ratatui::{
style::{Modifier, Style, Stylize},
text::Text,
widgets::{
Cell, HighlightSpacing, Paragraph, Row, Scrollbar, ScrollbarOrientation,
ScrollbarState, Table, TableState,
Cell, HighlightSpacing, Paragraph, Row, Scrollbar, ScrollbarOrientation, ScrollbarState,
Table, TableState,
},
Frame,
};
Expand All @@ -21,10 +21,7 @@ use std::{
use super::ui::TableColors;

use crate::{
balancer::{
upstream_peer::UpstreamPeer,
upstream_peer_pool::UpstreamPeerPool,
},
balancer::{upstream_peer::UpstreamPeer, upstream_peer_pool::UpstreamPeerPool},
errors::result::Result,
};

Expand Down Expand Up @@ -176,27 +173,20 @@ impl App {

items
.into_iter()
.map(|content| {
Cell::from(Text::from(content).white())
})
.map(|content| Cell::from(Text::from(content).white()))
.collect::<Row>()
.style(Style::new().fg(self.colors.row_fg).bg(color))
.height(1)
});

let bar = " █ ";
let t = Table::new(
rows,
[Constraint::Ratio(1, 6); 6],
)
.header(header)
.row_highlight_style(selected_row_style)
.highlight_symbol(Text::from(vec![
bar.into(),
]))
.bg(self.colors.buffer_bg)
.highlight_spacing(HighlightSpacing::Always)
.column_spacing(10);
let t = Table::new(rows, [Constraint::Ratio(1, 6); 6])
.header(header)
.row_highlight_style(selected_row_style)
.highlight_symbol(Text::from(vec![bar.into()]))
.bg(self.colors.buffer_bg)
.highlight_spacing(HighlightSpacing::Always)
.column_spacing(10);
frame.render_stateful_widget(t, area, &mut self.state);
}
},
Expand Down

0 comments on commit 9eb79e3

Please sign in to comment.