by drath · 5y ago · 0 comments
Another trick, at least in js, is to use destructuring assignment, e.g.
function calc_formula({a, b, is_gain}){
...
}
calc_formula({a:1, b:2, is_gain:true})Does this create garbage for the garbage collector (which might be an issue for inner loops)?
So yes, if performance is critical you should probably profile and consider avoiding this pattern, but for most cases the performance impact is very minor.