### Godot version

8449592d92eaeef990f5502b419d491ee3eeb7a6

### System information

Windows 11

### Issue description

Zooming in the script editor on an empty script freezes the entire editor for a few seconds, but if the file is large then it freezes for 4-5 seconds (which is unacceptable). Looks like a recent regression.

### Steps to reproduce

Just zoom in/out on the large script file.

### Minimal reproduction project

N/A
if (layout != FONT_LCD_SUBPIXEL_LAYOUT_NONE) {
			mod = (layout << 24);
		}
	}
	if (!_ensure_glyph(fd, size, p_glyph | mod)) {
		return RID(); 
	}
	const HashMap<int32_t, FontGlyph> &gl = fd->cache[size]->glyph_map;
	ERR_FAIL_COND_V(gl[p_glyph | mod].texture_idx < -1 || gl[p_glyph | mod].texture_idx >= fd->cache[size]->textures.size(), RID());
	if (RenderingServer::get_singleton() != nullptr) {
		if (gl[p_glyph | mod].texture_idx != -1) {
			if (fd->cache[size]->textures[gl[p_glyph | mod].texture_idx].dirty) {
				ShelfPackTexture &tex = fd->cache[size]->textures.write[gl[p_glyph | mod].texture_idx];
				Ref<Image> img = Image::create_from_data(tex.texture_w, tex.texture_h, false, tex.format, tex.imgdata);
				if (fd->mipmaps) {
					img->generate_mipmaps();
				}
				if (tex.texture.is_null()) {
					tex.texture = ImageTexture::create_from_image(img);
				} else {
					tex.texture->update(img);
				}
				tex.dirty = false;
			}
			return fd->cache[size]->textures[gl[p_glyph | mod].texture_idx].texture->get_rid();
		}
	}
	return RID();
}
Size2 TextServerFallback::_font_get_glyph_texture_size(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const {