Repository: alacritty/alacritty
File: alacritty/src/display/mod.rs (Rust)

Code before:
    }

    /// Process update events.
    ///
    /// XXX: this function must not call to any `OpenGL` related tasks. Only logical update
    /// of the state is being performed here. Rendering update takes part right before the
    /// actual rendering.
    pub fn handle_update<T>(
        &mut self,
        terminal: &mut Term<T>,
        pty_resize_handle: &mut dyn OnResize,
        message_buffer: &MessageBuffer,
        search_active: bool,
        config: &UiConfig,
    ) where
        T: EventListener,
    {
        let pending_update = mem::take(&mut self.pending_update);

        let (mut cell_width, mut cell_height) =
            (self.size_info.cell_width(), self.size_info.cell_height());

        if pending_update.font().is_some() || pending_update.cursor_dirty() {
            let pending_renderer_update =
                self.pending_renderer_update.get_or_insert(Default::default());
            pending_renderer_update.clear_font_cache = true
        }

        // Update font size and cell dimensions.
        if let Some(font) = pending_update.font() {
            let scale_factor = self.window.scale_factor;
            let cell_dimensions =
                Self::update_font_size(&mut self.glyph_cache, scale_factor, config, font);
            cell_width = cell_dimensions.0;
            cell_height = cell_dimensions.1;

            info!("Cell size: {} x {}", cell_width, cell_height);
        }

        let (mut width, mut height) = (self.size_info.width(), self.size_info.height());
        if let Some(dimensions) = pending_update.dimensions() {
            width = dimensions.width as f32;
            height = dimensions.height as f32;

            let pending_renderer_update =
                self.pending_renderer_update.get_or_insert(Default::default());
            pending_renderer_update.resize = true
        }

        let padding = config.window.padding(self.window.scale_factor);


Review comment (performance):
```suggestion
            let renderer_update = self.pending_renderer_update.get_or_insert(Default::default());
            renderer_update.clear_font_cache = true
```

Just a super short temporary variable, should be fine to use a little bit of a shorthand.

Code after:
        let cache = &mut self.glyph_cache;
        self.renderer.with_loader(|mut api| {
            cache.reset_glyph_cache(&mut api);
        });
    }

    /// Process update events.
    ///
    /// XXX: this function must not call to any `OpenGL` related tasks. Only logical update
    /// of the state is being performed here. Rendering update takes part right before the
    /// actual rendering.
    pub fn handle_update<T>(
        &mut self,
        terminal: &mut Term<T>,
        pty_resize_handle: &mut dyn OnResize,
        message_buffer: &MessageBuffer,
        search_active: bool,
        config: &UiConfig,
    ) where
        T: EventListener,
    {
        let pending_update = mem::take(&mut self.pending_update);

        let (mut cell_width, mut cell_height) =
            (self.size_info.cell_width(), self.size_info.cell_height());

        if pending_update.font().is_some() || pending_update.cursor_dirty() {
            let renderer_update = self.pending_renderer_update.get_or_insert(Default::default());
            renderer_update.clear_font_cache = true
        }

        // Update font size and cell dimensions.
        if let Some(font) = pending_update.font() {
            let scale_factor = self.window.scale_factor;
            let cell_dimensions =
                Self::update_font_size(&mut self.glyph_cache, scale_factor, config, font);
            cell_width = cell_dimensions.0;
            cell_height = cell_dimensions.1;

            info!("Cell size: {} x {}", cell_width, cell_height);
        }

        let (mut width, mut height) = (self.size_info.width(), self.size_info.height());
        if let Some(dimensions) = pending_update.dimensions() {
            width = dimensions.width as f32;
            height = dimensions.height as f32;

            let renderer_update = self.pending_renderer_update.get_or_insert(Default::default());
            renderer_update.resize = true
        }