### 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
return true;
	}
	sd->utf16 = sd->text.utf16();
	const UChar *data = sd->utf16.get_data();
	
	if (sd->script_iter == nullptr) {
		sd->script_iter = memnew(ScriptIterator(sd->text, 0, sd->text.length()));
	}
	sd->base_para_direction = UBIDI_DEFAULT_LTR;
	switch (sd->direction) {
		case DIRECTION_LTR: {
			sd->para_direction = DIRECTION_LTR;
			sd->base_para_direction = UBIDI_LTR;
		} 
		case DIRECTION_RTL: {
			sd->para_direction = DIRECTION_RTL;
			sd->base_para_direction = UBIDI_RTL;
		} 
		case DIRECTION_INHERITED:
		case DIRECTION_AUTO: {
			UBiDiDirection direction = ubidi_getBaseDirection(data, sd->utf16.length());
			if (direction != UBIDI_NEUTRAL) {
				sd->para_direction = (direction == UBIDI_RTL) ? DIRECTION_RTL : DIRECTION_LTR;
				sd->base_para_direction = direction;
			} else {
				const String &lang = (sd->spans.is_empty() || sd->spans[0].language.is_empty()) ? TranslationServer::get_singleton()->get_tool_locale() : sd->spans[0].language;
				bool lang_rtl = _is_locale_right_to_left(lang);
				sd->para_direction = lang_rtl ? DIRECTION_RTL : DIRECTION_LTR;
				sd->base_para_direction = lang_rtl ? UBIDI_DEFAULT_RTL : UBIDI_DEFAULT_LTR;
			}