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

Code before:
            colors: List::from(&config.colors),
            pending_update: Default::default(),
            pending_renderer_update: Default::default(),
            is_damage_supported,
            debug_damage,
            damage_rects,
        })
    }

    /// Update font size and cell dimensions.
    ///
    /// This will return a tuple of the cell width and height.
    fn update_font_size(
        glyph_cache: &mut GlyphCache,
        scale_factor: f64,
        config: &UiConfig,
        font: &Font,
    ) -> (f32, f32) {
        let _ = glyph_cache.update_font_size(font, scale_factor);

        // Compute new cell sizes.
        compute_cell_size(config, &glyph_cache.font_metrics())
    }

    /// Clear glyph cache.
    fn clear_glyph_cache(&mut self) {
        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());

Review comment (performance):
```suggestion
    fn reset_glyph_cache(&mut self) {
```

Just for consistency, the docs probably should also be updated.

Code after:
            colors: List::from(&config.colors),
            pending_update: Default::default(),
            pending_renderer_update: Default::default(),
            is_damage_supported,
            debug_damage,
            damage_rects,
        })
    }

    /// Update font size and cell dimensions.
    ///
    /// This will return a tuple of the cell width and height.
    fn update_font_size(
        glyph_cache: &mut GlyphCache,
        scale_factor: f64,
        config: &UiConfig,
        font: &Font,
    ) -> (f32, f32) {
        let _ = glyph_cache.update_font_size(font, scale_factor);

        // Compute new cell sizes.
        compute_cell_size(config, &glyph_cache.font_metrics())
    }

    /// Reset glyph cache.
    fn reset_glyph_cache(&mut self) {
        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());