### 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
int ascent = 0;
	int outline = 0;
	BitField<TextServer::FontStyle> st_flags = 0;
	String font_name;
	bool packed = false;
	uint8_t ch[4] = { 0, 0, 0, 0 }; 
	int first_gl_ch = -1;
	int first_ol_ch = -1;
	int first_cm_ch = -1;
	unsigned char magic[4];
	f->get_buffer((unsigned char *)&magic, 4);
	if (magic[0] == 'B' && magic[1] == 'M' && magic[2] == 'F') {
		
		ERR_FAIL_COND_V_MSG(magic[3] != 3, ERR_CANT_CREATE, vformat(RTR("Version %d of BMFont is not supported (should be 3)."), (int)magic[3]));
		uint8_t block_type = f->get_8();
		uint32_t block_size = f->get_32();
		bool unicode = false;
		uint8_t encoding = 9;
		while (!f->eof_reached()) {
			uint64_t off = f->get_position();
			switch (block_type) {
				case 1:  {
					ERR_FAIL_COND_V_MSG(block_size < 15, ERR_CANT_CREATE, RTR("Invalid BMFont info block size."));
					base_size = f->get_16();
					if (base_size <= 0) {
						base_size = 16;
					}
					uint8_t flags = f->get_8();
					if (flags & (1 << 3)) {
						st_flags.set_flag(TextServer::FONT_BOLD);