Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1643253 > unrolled thread

Re: [PATCH] seq_file: delete small-value optimization

Started byAlexey Dobriyan <adobriyan@gmail.com>
First post2017-05-17 12:40 +0200
Last post2017-05-18 01:30 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  Re: [PATCH] seq_file: delete small-value optimization Alexey Dobriyan <adobriyan@gmail.com> - 2017-05-17 12:40 +0200
    Re: [PATCH] seq_file: delete small-value optimization Joe Perches <joe@perches.com> - 2017-05-18 01:30 +0200

#1643253 — Re: [PATCH] seq_file: delete small-value optimization

FromAlexey Dobriyan <adobriyan@gmail.com>
Date2017-05-17 12:40 +0200
SubjectRe: [PATCH] seq_file: delete small-value optimization
Message-ID<tI4x4-1Sb-15@gated-at.bofh.it>
> Joe Perches wrote:
> 
> On Tue, 2017-05-16 at 23:42 +0300, Alexey Dobriyan wrote:
> > num_to_str() optimizes printing small integers [0..9], so the same
> > check higher in callchain is unnecessary.
> 
> Doesn't the optimization exists for the frequent use of 0
> in seq output?  
> 
> These seq_put_decimal calls are now slightly more expensive.

That additional CALL instruction is hardly measurable so you're adding
branch to skip branch in the next function.

[toc] | [next] | [standalone]


#1643692

FromJoe Perches <joe@perches.com>
Date2017-05-18 01:30 +0200
Message-ID<tIgyd-1fy-5@gated-at.bofh.it>
In reply to#1643253
On Wed, 2017-05-17 at 13:33 +0300, Alexey Dobriyan wrote:
> > Joe Perches wrote:
> > 
> > On Tue, 2017-05-16 at 23:42 +0300, Alexey Dobriyan wrote:
> > > num_to_str() optimizes printing small integers [0..9], so the same
> > > check higher in callchain is unnecessary.
> > 
> > Doesn't the optimization exists for the frequent use of 0
> > in seq output?  
> > 
> > These seq_put_decimal calls are now slightly more expensive.
> 
> That additional CALL instruction is hardly measurable so you're adding
> branch to skip branch in the next function.

It's not the call instruction.

num_to_str pushes the value first to stack
and then sets up a loop to copy those chars
to buffer.

The current code immediately pushes to buffer.

It's a fair amount of overhead.

Have you measured it?

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web