JavaScript Performance Hit Calling Function vs. Inline

I know there is a performance hit when calling a function vs just running the code right there but I was curious how much that would be in different browsers. I went over to one of my favorite JS testing sites, http://jsperf.com/ , and setup a simple test. Running a few tests on a few different browsers suggests that there is about a 50% performance hit when calling a function with a small task.

You can check out the most recent results at http://jsperf.com/function-call-vs-inline and test your own browser.

Published by

MikeGrace

I am a Geek! I hope you enjoyed this recent post.