[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-devel] Paper: A Comparison of TCP Implementations, Linux vs. l
From: |
Simon Goldschmidt |
Subject: |
Re: [lwip-devel] Paper: A Comparison of TCP Implementations, Linux vs. lwIP |
Date: |
Mon, 22 May 2017 11:44:56 +0200 |
Richard Siegfried wrote:
> Another question which always surprised me (not part of the paper I think):
> Is there a reason lwIP doesn't use inline functions for performance?
Yes.
> Linux usess them a lot.
That brings me back to my original question: why have you compared Linux to
lwIP?
The two systems are targeting fundamentally different devices. One result of
which is we
try to keep code size to a minimum and in most situations, a function call to a
central
place is much smaller than having the code twice in a binary. The only
exception to that
is if the function is only used once. In C, this is covered by making the
function static
inside the C file.
In contrast to that, it seems to me that Linux often just uses 'inline' because
someone
thinks this might speed up things (although the opposite could happen depending
on cache
sizes). And you have to really argue hard with them to accept a patch removing
an 'inline'
statement.
> (The inline keyword is part of C99 standards, or as a gcc extension
> before that. http://www.greenend.org.uk/rjk/tech/inline.html)
Welcome in the world of embedded compilers. We still target C89.
*And* welcome in the world of portability: vendor extensions are not allowed!
Unless I'm
mistaken, Linux is still limited to GCC (and maybe CLANG).
Simon