Guys I would like a theoretical answer for this question.
I would like to know if calling f.call(null,x) is any possibly slower than calling f(x) ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, it will be very marginally slower because of the addition property lookup (finding member
callon functionf). It is very much a micro-optimization and not something that should put you off usingcall()when it’s necessary.On the other hand, I’ve noticed that functions created with
bind()are slower than their unbound counterparts and also slower than usingcall(), in most browsers. Just in case you were thinking that may be a way around any performance deficit.Note that someone has already set up some tests for this over at http://jsperf.com.