Re: [Lse-tech] Re: [PATCH]updated ipc lock patch

From: Robert Love (rml@tech9.net)
Date: Thu Oct 24 2002 - 20:07:50 EST


On Thu, 2002-10-24 at 20:35, Rick Lindsley wrote:

> There was a time when "inline" was a very cool tool because it had been
> judged that the overhead of actually calling a function was just too
> heinous to contemplate. From comments in this and other discussions,
> is it safe to say that the pendulum has now swung the other way? I see
> a lot of people concerned about code size and apparently returning to
> the axiom of "if you use it more than once, make it a function." Are
> we as a community coming around to using inlining only on very tight,
> very critical functions?

I think so, at least Andrew is championing us in that direction. But I
agree.

It somewhere became the notion if the function is small, it
automatically should be inlined. I suspect Andrew has even stricter
criteria than me (I think super small functions should be inlined) but
the general "its only a couple of lines" or "it could be a macro" are
not sufficient criterion for inlining.

So, my thoughts on suitable criteria would be:

        - used only once and only ever in that one spot (i.e.
          it really could be part of the caller, but it was pulled
          out for cleanliness. Keep it inline to not have the
          cleanliness cause a performance degradation (however
          small)).

        - small functions, where small is so small the function
          overhead is nearly the same size. Stuff that might not
          even do anything but return a permutation of an argument,
          etc.

        - very very time critical functions in time critical places

So that removes the previous criteria of "the function is N lines or
smaller" where N is some number less than 100 :)

        Robert Love

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Oct 31 2002 - 22:00:26 EST