소스 검색

Avoid extra copy/validation of keys in Dictionary::has_all

Updated Dictionary::has_all to check its HashMap directly for each validated key instead of going through Dictionary::has, to avoid additional copy/validation of each key.
aaronp64 4 달 전
부모
커밋
e4bd611e19
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      core/variant/dictionary.cpp

+ 1 - 1
core/variant/dictionary.cpp

@@ -225,7 +225,7 @@ bool Dictionary::has_all(const Array &p_keys) const {
 	for (int i = 0; i < p_keys.size(); i++) {
 		Variant key = p_keys[i];
 		ERR_FAIL_COND_V(!_p->typed_key.validate(key, "use 'has_all'"), false);
-		if (!has(key)) {
+		if (!_p->variant_map.has(key)) {
 			return false;
 		}
 	}