### 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 (sd->bidi_override.is_empty()) {
		sd->bidi_override.push_back(Vector3i(sd->start, sd->end, DIRECTION_INHERITED));
	}
	for (int ov = 0; ov < sd->bidi_override.size(); ov++) {
		
		int start = _convert_pos_inv(sd, sd->bidi_override[ov].x - sd->start);
		int end = _convert_pos_inv(sd, sd->bidi_override[ov].y - sd->start);
		if (start < 0 || end - start > sd->utf16.length()) {
			continue;
		}
		UErrorCode err = U_ZERO_ERROR;
		UBiDi *bidi_iter = ubidi_openSized(end - start, 0, &err);
		if (U_SUCCESS(err)) {
			switch (static_cast<TextServer::Direction>(sd->bidi_override[ov].z)) {
				case DIRECTION_LTR: {
					ubidi_setPara(bidi_iter, data + start, end - start, UBIDI_LTR, nullptr, &err);
				} 
				case DIRECTION_RTL: {
					ubidi_setPara(bidi_iter, data + start, end - start, UBIDI_RTL, nullptr, &err);
				} 
				case DIRECTION_INHERITED: {
					ubidi_setPara(bidi_iter, data + start, end - start, sd->base_para_direction, nullptr, &err);
				} 
				case DIRECTION_AUTO: {
					UBiDiDirection direction = ubidi_getBaseDirection(data + start, end - start);
					if (direction != UBIDI_NEUTRAL) {
						ubidi_setPara(bidi_iter, data + start, end - start, direction, nullptr, &err);
					} else {