### 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
sd_glyphs_new[sd_shift + i].flags |= GRAPHEME_IS_TAB;
			}
			if (is_whitespace(c)) {
				sd_glyphs_new[sd_shift + i].flags |= GRAPHEME_IS_SPACE;
			}
			if (c_punct_size 
				if (u_ispunct(c) && c != 0x005f) {
					sd_glyphs_new[sd_shift + i].flags |= GRAPHEME_IS_PUNCTUATION;
				}
			} else {
				for (int j = 0; j < c_punct_size; j++) {
					if (c_punct[j] == c) {
						sd_glyphs_new[sd_shift + i].flags |= GRAPHEME_IS_PUNCTUATION;
						
					}
				}
			}
			if (is_underscore(c)) {
				sd_glyphs_new[sd_shift + i].flags |= GRAPHEME_IS_UNDERSCORE;
			}
			if (sd->breaks.has(sd_glyphs[i].end)) {
				if (sd->breaks[sd_glyphs[i].end] && (is_linebreak(c))) {
					sd_glyphs_new[sd_shift + i].flags |= GRAPHEME_IS_BREAK_HARD;
				} else if (is_whitespace(c)) {
					sd_glyphs_new[sd_shift + i].flags |= GRAPHEME_IS_BREAK_SOFT;
				} else {
					int count = sd_glyphs[i].count;
					
					if (sd_glyphs[i].end == sd->end) {
						i += (sd_glyphs[i].count - 1);