### 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 (dirty_rids) {
		_update_rids();
	}
	real_t ret = 0.f;
	for (int i = 0; i < rids.size(); i++) {
		ret = MAX(ret, TS->font_get_ascent(rids[i], p_font_size));
	}
	return ret + get_spacing(TextServer::SPACING_TOP);
}
real_t Font::get_descent(int p_font_size) const {
	if (dirty_rids) {
		_update_rids();
	}
	real_t ret = 0.f;
	for (int i = 0; i < rids.size(); i++) {
		ret = MAX(ret, TS->font_get_descent(rids[i], p_font_size));
	}
	return ret + get_spacing(TextServer::SPACING_BOTTOM);
}
real_t Font::get_underline_position(int p_font_size) const {
	if (dirty_rids) {
		_update_rids();
	}
	real_t ret = 0.f;
	for (int i = 0; i < rids.size(); i++) {
		ret = MAX(ret, TS->font_get_underline_position(rids[i], p_font_size));
	}
	return ret + get_spacing(TextServer::SPACING_TOP);
}
real_t Font::get_underline_thickness(int p_font_size) const {