Thread (5 messages) 5 messages, 2 authors, 2021-09-14

Re: [PATCH] btrfs: make btrfs_node_key static inline

From: Su Yue <hidden>
Date: 2021-09-14 14:17:42

On Tue 14 Sep 2021 at 15:12, David Sterba [off-list ref] wrote:
On Tue, Sep 14, 2021 at 06:53:35PM +0800, Su Yue wrote:
quoted
It looks strange that btrfs_node_key is in struct-funcs.c.
So move it to ctree.h and make it static inline.
"looks strange" is not a sufficient reason. Inlining a function 
means
that the body will be expanded at each call site, bloating the 
binary
code. Have you measured the impact of that?
Fair enough.

Before:
   text    data     bss     dec     hex filename
1202418  123105   19384 1344907  14858b fs/btrfs/btrfs.ko
After:
   text    data     bss     dec     hex filename
1202620  123105   19384 1345109  148655 fs/btrfs/btrfs.ko

+202
There's some performance cost of an non-inline function due to 
the call
overhead but it does not make sense to inline a function that's 
called
rarely and not in a tight loop. If you grep for the function 
you'd see
that it's called eg. once per function or in a loop that's not
performance critical on first sight (eg. in reada_for_search).
Right, the patch won't impact performance obviously at the cost of
+202 binary size. So I'd drop the patch.

Sorry for the noise.

--
Su
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help