[CTRL++] Reduce temporary objects
Every assignment of object and values to another object or value takes some time because it is a copy of the memory.
// Instead ofSomeClass mo1 = getSomeModelObject();AnotherClass mo2 = getAnotherModelObject();doSomething(mo1, mo2);// consider:doSomething(getSomeModelObject(), getAnotherModelObject());
For speed improvement it is recommended to avoid temporary objects if not needed later on again.
shared_ptr<ClassA> a = new ClassA();...a = nullptr; // if you do not need it anymore in the scope destroy...
Date added:
Last revised:
Hits:
11.129
Rating:
Tags:
Programming / Scripting, OOP