Timeline for Are there guidelines on how many parameters a function should accept?
Current License: CC BY-SA 3.0
5 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Nov 4, 2017 at 1:07 | history | edited | Leo | CC BY-SA 3.0 |
Thoughts on inlining
|
Nov 4, 2017 at 0:50 | comment | added | Leo |
@KjMag: Yes, to a certain degree. But there are a lot of gotchas depending on the compiler. Functions will usually only be inlined up to a certain level (if you call an inlined function that calls an inlined function that calls an inlined function....). If the function is large and is called from a lot of places, inlining everywhere makes the binary larger which may mean more misses in the I-cache. So inlining can help, but it's no silver bullet. (Not to mention there are quite a few old embedded compilers that don't support inline .)
|
|
Nov 3, 2017 at 10:51 | comment | added | KjMag | Doesn't inlining solve this problem? | |
Sep 2, 2014 at 21:44 | comment | added | supercat | Whether passing a large number of parameters is good or bad from a performance perspective depends upon the alternatives. If a method needs a dozen pieces of information, and one will be calling it hundreds of times with the same values for eleven of them, having the method take an array could be faster than having it take a dozen parameters. On the other hand, if every call will need a unique set of twelve values, creating and populating the array for each call could easily be slower than simply passing the values directly. | |
Apr 19, 2012 at 14:38 | history | answered | Leo | CC BY-SA 3.0 |