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

Code before:
        let dimensions = config.window.dimensions();
        let estimated_size = dimensions.map(|dimensions| {
            window_size(config, dimensions, cell_width, cell_height, estimated_scale_factor)
        });

        debug!("Estimated scaling factor: {}", estimated_scale_factor);
        debug!("Estimated window size: {:?}", estimated_size);
        debug!("Estimated cell size: {} x {}", cell_width, cell_height);

        // Spawn the Alacritty window.
        let mut window = Window::new(
            event_loop,
            config,
            identity,
            estimated_size,
            #[cfg(all(feature = "wayland", not(any(target_os = "macos", windows))))]
            wayland_event_queue,
        )?;

        // Create renderer.
        let mut renderer = QuadRenderer::new()?;

        let scale_factor = window.scale_factor;
        info!("Display scale factor: {}", scale_factor);

        // If the scaling factor changed update the glyph cache and resize latter on.
        let should_resize = (estimated_scale_factor - window.scale_factor).abs() > f64::EPSILON;
        let (cell_width, cell_height) = if should_resize {
            Self::update_glyph_cache(&mut renderer, &mut glyph_cache, scale_factor, config, font)
        } else {
            (cell_width, cell_height)
        };

        // Load font common glyphs to accelerate rendering.
        {
            info!("Initializing glyph cache...");
            let init_start = Instant::now();

            renderer.with_loader(|mut api| {
                glyph_cache.load_common_glyphs(&mut api);
            });

            let stop = init_start.elapsed();
            let stop_f = stop.as_secs() as f64 + f64::from(stop.subsec_nanos()) / 1_000_000_000f64;
            info!("... finished initializing glyph cache in {}s", stop_f);
        }

        if let Some(dimensions) = should_resize.then(|| dimensions).flatten() {
            // Resize the window again if the scale factor was not estimated correctly.
            let size =
                window_size(config, dimensions, cell_width, cell_height, window.scale_factor);

Review comment (performance):
```suggestion
        // If the scaling factor changed update the glyph cache and mark for resize.
```

Code after:
        let dimensions = config.window.dimensions();
        let estimated_size = dimensions.map(|dimensions| {
            window_size(config, dimensions, cell_width, cell_height, estimated_scale_factor)
        });

        debug!("Estimated scaling factor: {}", estimated_scale_factor);
        debug!("Estimated window size: {:?}", estimated_size);
        debug!("Estimated cell size: {} x {}", cell_width, cell_height);

        // Spawn the Alacritty window.
        let mut window = Window::new(
            event_loop,
            config,
            identity,
            estimated_size,
            #[cfg(all(feature = "wayland", not(any(target_os = "macos", windows))))]
            wayland_event_queue,
        )?;

        // Create renderer.
        let mut renderer = QuadRenderer::new()?;

        let scale_factor = window.scale_factor;
        info!("Display scale factor: {}", scale_factor);

        // If the scaling factor changed update the glyph cache and mark for resize.
        let should_resize = (estimated_scale_factor - window.scale_factor).abs() > f64::EPSILON;
        let (cell_width, cell_height) = if should_resize {
            Self::update_glyph_cache(&mut renderer, &mut glyph_cache, scale_factor, config, font)
        } else {
            (cell_width, cell_height)
        };

        // Load font common glyphs to accelerate rendering.
        debug!("Filling glyph cache with common glyphs");
        renderer.with_loader(|mut api| {
            glyph_cache.load_common_glyphs(&mut api);
        });

        if let Some(dimensions) = dimensions.filter(|_| should_resize) {
            // Resize the window again if the scale factor was not estimated correctly.
            let size =
                window_size(config, dimensions, cell_width, cell_height, window.scale_factor);
            window.set_inner_size(size);
        }

        let padding = config.window.padding(window.scale_factor);
        let viewport_size = window.inner_size();

        // Create new size with at least one column and row.
        let size_info = SizeInfo::new(