Optimized variant reference function.

Optimized critical execution path in Variant::reference by removing expensive and unnecessary call to clear for atomic types.
This commit is contained in:
Valentin Zagura 2019-09-09 10:39:40 +01:00
parent 24e1039eb6
commit 6a36779e89
1 changed files with 9 additions and 1 deletions

View File

@ -910,7 +910,15 @@ bool Variant::is_one() const {
void Variant::reference(const Variant &p_variant) {
clear();
switch (type) {
case NIL:
case BOOL:
case INT:
case REAL:
break;
default:
clear();
}
type = p_variant.type;