About performance
if a function takes only one paramater
and i pass unnecessary additional parameters would it affect the performance of just the function part of the code?
this is what im caonfused abt
i have a object, every value is a function that takes the same parameter
payload
except only one value that takes an additional second parameter args
i want to know which way from these two would perform better
4 Replies
sorry for not using typescript types, i asked the same question in a javascript server, i copy pasted here too
IIRC It does have some effect, yes, but nothing particularly horrible.
I expect the latter might be better simply because less parameters means less polymorphism.
I believe more args than expected can cause deopts if you are inconsistent with the amount of args passed to that function
If I keep passing 2 args to function
a
it shouldn't deopt where-as if I later pass 1 it might deopti see tyvm!