From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754695AbdEQXZJ (ORCPT ); Wed, 17 May 2017 19:25:09 -0400 Received: from smtprelay0101.hostedemail.com ([216.40.44.101]:33962 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753723AbdEQXZH (ORCPT ); Wed, 17 May 2017 19:25:07 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::,RULES_HIT:41:355:379:541:599:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1540:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:2828:3138:3139:3140:3141:3142:3352:3622:3865:3866:3867:3868:3870:3871:3872:3873:3874:4250:4321:5007:8660:10004:10400:10848:11026:11232:11658:11914:12740:12760:12895:13069:13148:13161:13229:13230:13311:13357:13439:13869:14659:21080:21451:21627:30005:30012:30054:30070:30079:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:3,LUA_SUMMARY:none X-HE-Tag: robin84_49657b81d6b59 X-Filterd-Recvd-Size: 1530 Message-ID: <1495063501.31562.26.camel@perches.com> Subject: Re: [PATCH] seq_file: delete small-value optimization From: Joe Perches To: Alexey Dobriyan Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org Date: Wed, 17 May 2017 16:25:01 -0700 In-Reply-To: <20170517103341.GB28488@avx2> References: <20170517103341.GB28488@avx2> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.22.6-1ubuntu1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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?