is there any references that detail the “cost” of different code parts?
lol, the first code i ever learned was some assembly language, relating to electronic engineering and literally EVERY function, every class, etc was highly documented, how many milliseconds each takes, … so i wonder if there is something like that with C# , and Unity?
hmm… i guess there is probably something in the debugging that could tell me?? i dont know quite much as of yet…
I suppose its probably not all that important, especially since computers are getting better and better, and its just games…
but i want to become PRO
multiplication is less costly than division…???
and getcomponent is less costly than sendmessage… ???
thats all i know so far, and just cause some youtube video guy said so
As the previous poster said a few things prevent having precise rules about the expense of operations as compared to your old assembly days.
First - your code may run on many different processors which may have very different properties.
Second - your code gets compiled/interpreted and often times you might go through the trouble to turn a multiply into a divide or a multiply into a bit shift only to find the compiler was already doing that. Or maybe it wasn’t, or maybe it was undoing your efforts. Only way to know is profile it, and the best course of action is not to worry about these things until the profile shows you where the slow spots are.
Algorithmic efficiency first. Bit twiddling second only if necessary.