From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751363AbdIPJ6d (ORCPT ); Sat, 16 Sep 2017 05:58:33 -0400 Received: from smtprelay0199.hostedemail.com ([216.40.44.199]:56558 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751050AbdIPJ6b (ORCPT ); Sat, 16 Sep 2017 05:58:31 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::,RULES_HIT:41:355:379:541:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1381:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2198:2199:2393:2559:2562:2693:2828:3138:3139:3140:3141:3142:3353:3622:3865:3866:3867:3868:3870:3871:3872:3873:3874:4250:4321:5007:7875:8527:8660:10004:10400:10848:10903:11026:11232:11658:11914:12048:12740:12760:12895:13069:13148:13230:13311:13357:13439:14096:14097:14181:14659:14721:21080:21451:21611:21627:30012:30054:30070: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:2,LUA_SUMMARY:none X-HE-Tag: tray75_84603b669261c X-Filterd-Recvd-Size: 2240 Message-ID: <1505555908.16316.5.camel@perches.com> Subject: Re: [PATCH V2] tipc: Use bsearch library function From: Joe Perches To: Ying Xue , Thomas Meyer , jon.maloy@ericsson.com, netdev@vger.kernel.org, tipc-discussion@lists.sourceforge.net, linux-kernel@vger.kernel.org, davem@davemloft.net Date: Sat, 16 Sep 2017 02:58:28 -0700 In-Reply-To: <64ee51ce-eb7e-ac1c-56a9-9481f6f80b35@windriver.com> References: <20170911.143025.555018840006192902.davem@davemloft.net> <20170916075036.28676-1-thomas@m3y3r.de> <16128f5e-66ff-b6ec-c0e1-74ea08c212b0@windriver.com> <1505553970.16316.1.camel@perches.com> <64ee51ce-eb7e-ac1c-56a9-9481f6f80b35@windriver.com> 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 Sat, 2017-09-16 at 17:36 +0800, Ying Xue wrote: > On 09/16/2017 05:26 PM, Joe Perches wrote: > > On Sat, 2017-09-16 at 17:02 +0800, Ying Xue wrote: > > > On 09/16/2017 03:50 PM, Thomas Meyer wrote: > > > > Use common library function rather than explicitly coding > > > > some variant of it yourself. > > > > > > > > Signed-off-by: Thomas Meyer > > > > > > Acked-by: Ying Xue > > > > Are you sure you want to do this? > > > > Note the comment above nameseq_find_subseq > > > > * Very time-critical, so binary searches through sub-sequence array. > > > > What impact does this change have on performance? > > Sorry, I couldn't see any essential difference between this new > implementation and the original one except that the former tries to use > the library function - bsearch() to replace the original binary search > algorithm implemented in TIPC itself. Therefore, I don't think the > change will have a big impact on performance. > > If I miss something, please let me know. Comparison via a function pointer in bsearch is slower than direct code without the function call overhead.