performance - is it more optimal to assign and then multiply with *= ? in this case? -
in interest of being light weight possible in code must run potentially 60 times per second or more in animation scenario, became curious on seemingly insignificant 2 lines of code.
i know performance benefit nil, in interest of understanding better how code works in cpu, ask following question:
does 1 of these sequences generate more optimal (even minimally) set of cpu operations, , why? (or possibly, "why not?")
assume un-optimized compilation scenario, obviously.
obja.scalex = _inversionfactor * value; obja.scaley = value;
vs.
obja.scalex = obja.scaley = value; obja.scalex *= _inversionfactor;
assume un-optimized compilation scenario, obviously.
since interested in performance , optimization, not obvious, rather schizophrenic assume that.
i know compiler/performance people on these channels, how cpu sees these operations.
the cpu not see these operations @ all, sees compiler has made of them, , depends on compiler, obviously.
"in perfect world expressed pure cpu instructions or assembly, 1 of these better"
you overlooking there not 1 way express source code cpu instructions, , question underspecified.
Comments
Post a Comment