+ 2
Return | Simple function
I was thinking if someone know an advantage/problem to convert a basic function from: function( param1, param2 ){ var result = param1 % param2; return result; } To something like: function( param1, param2 ){ return param1 % param2; } When we do not need to check params or do something else? Cause I'm curious to know if declare X times the same var is good for performances.
2 odpowiedzi
+ 1
I think declaring less local variable is good for performance because it consumes less registry in the processor, in c# we are suggested to only have 64 locals including compiler generated variable in a method because the processor registry only can hold maximum 64 locals.
+ 1
Ok, thanks for your answer, I guessed something like that. Must be hard to find the correct balance between to many local var to keep an easy to read code and no local var.