Repository: godotengine/godot
File: editor/gui/editor_quick_open_dialog.cpp (C++)

Code before:
		if (candidates_uids.has(uid)) {
			continue;
		}

		bool success;
		QuickOpenResultCandidate candidate = QuickOpenResultCandidate::from_uid(uid, success);
		if (!success) {
			continue;
		}

		_add_candidate(candidate);
	}
}

void QuickOpenResultContainer::_update_fuzzy_search_results() {
	FuzzySearch fuzzy_search;
	fuzzy_search.start_offset = 6; // Don't match against "res://" at the start of each filepath.
	fuzzy_search.set_query(query);
	fuzzy_search.max_results = max_total_results;
	bool fuzzy_matching = EDITOR_GET("filesystem/quick_open_dialog/enable_fuzzy_matching");
	int max_misses = EDITOR_GET("filesystem/quick_open_dialog/max_fuzzy_misses");
	fuzzy_search.allow_subsequences = fuzzy_matching;
	fuzzy_search.max_misses = fuzzy_matching ? max_misses : 0;

	PackedStringArray paths;
	paths.reserve(uids.size());

	for (const ResourceUID::ID &uid : uids) {
		paths.push_back(ResourceUID::get_singleton()->get_id_path(uid));
	}

	fuzzy_search.search_all(paths, search_results);
}

void QuickOpenResultContainer::_score_and_sort_candidates() {
	_update_fuzzy_search_results();

	for (const FuzzySearchResult &result : search_results) {
		bool success;
		QuickOpenResultCandidate candidate = QuickOpenResultCandidate::from_result(result, success);
		if (!success) {
			continue;
		}

		_add_candidate(candidate);
	}
}

void QuickOpenResultContainer::_update_result_items(int p_new_visible_results_count, int p_new_selection_index) {
	// Only need to update items that were not hidden in previous update.
	int num_items_needing_updates = MAX(num_visible_results, p_new_visible_results_count);

Review comment (suggestion):
```suggestion
	paths.reserve_exact(uids.size());
```
This is better if the array is not going to grow.

Code after:
	fuzzy_search.max_misses = fuzzy_matching ? max_misses : 0;

	PackedStringArray paths;
	paths.reserve_exact(uids.size());

	for (const ResourceUID::ID &uid : uids) {
		paths.push_back(ResourceUID::get_singleton()->get_id_path(uid));
	}

	fuzzy_search.search_all(paths, search_results);
}

void QuickOpenResultContainer::_score_and_sort_candidates() {
	_update_fuzzy_search_results();

	for (const FuzzySearchResult &result : search_results) {
		bool success;
		QuickOpenResultCandidate candidate = QuickOpenResultCandidate::from_result(result, success);
		if (!success) {
			continue;
		}

		_add_candidate(candidate);
	}
}

void QuickOpenResultContainer::_update_result_items(int p_new_visible_results_count, int p_new_selection_index) {
	// Only need to update items that were not hidden in previous update.
	int num_items_needing_updates = MAX(num_visible_results, p_new_visible_results_count);
	num_visible_results = p_new_visible_results_count;

	for (int i = 0; i < num_items_needing_updates; i++) {
		QuickOpenResultItem *item = result_items[i];

		if (i < num_visible_results) {
			item->set_content(candidates[i]);
		} else {
			item->reset();
		}
	};

	const bool any_results = num_visible_results > 0;
	_select_item(any_results ? p_new_selection_index : -1);

	scroll_container->set_visible(any_results);
	no_results_container->set_visible(!any_results);

	if (!any_results) {
		if (uids.is_empty()) {
			no_results_label->set_text(TTR("No files found for this type"));
		} else {