perf: refactor to reduce memory allocations and cpu work
This commit is contained in:
parent
0c3e3c8629
commit
dd0158d8f0
24 changed files with 234 additions and 242 deletions
|
|
@ -125,12 +125,11 @@ impl Window {
|
|||
first_day_of_week,
|
||||
);
|
||||
|
||||
let mut day_iter = first_day.iter_days();
|
||||
let day_iter = first_day.iter_days();
|
||||
let prefs = DateTimeFormatterPreferences::from(self.locale.clone());
|
||||
let weekday = DateTimeFormatter::try_new(prefs, fieldsets::E::short()).unwrap();
|
||||
|
||||
for _ in 0..7 {
|
||||
let date = day_iter.next().unwrap();
|
||||
for date in day_iter.take(7) {
|
||||
let datetime = self.create_datetime(&date);
|
||||
calendar = calendar.push(
|
||||
text::caption(weekday.format(&datetime).to_string())
|
||||
|
|
@ -447,7 +446,7 @@ impl cosmic::Application for Window {
|
|||
}
|
||||
|
||||
let show_seconds_rx = self.show_seconds_tx.subscribe();
|
||||
Subscription::batch(vec![
|
||||
Subscription::batch([
|
||||
rectangle_tracker_subscription(0).map(|e| Message::Rectangle(e.1)),
|
||||
time_subscription(show_seconds_rx),
|
||||
activation_token_subscription(0).map(Message::Token),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue