Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751422AbdIPNff (ORCPT ); Sat, 16 Sep 2017 09:35:35 -0400 Received: from sesbmg23.ericsson.net ([193.180.251.37]:42630 "EHLO sesbmg23.ericsson.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751211AbdIPNfe (ORCPT ); Sat, 16 Sep 2017 09:35:34 -0400 X-Greylist: delayed 901 seconds by postgrey-1.27 at vger.kernel.org; Sat, 16 Sep 2017 09:35:33 EDT X-AuditID: c1b4fb25-967ff70000005333-90-59bd251f8e98 From: Jon Maloy To: Joe Perches , Ying Xue , "Thomas Meyer" , "netdev@vger.kernel.org" , "tipc-discussion@lists.sourceforge.net" , "linux-kernel@vger.kernel.org" , "davem@davemloft.net" Subject: RE: [PATCH V2] tipc: Use bsearch library function Thread-Topic: [PATCH V2] tipc: Use bsearch library function Thread-Index: AQHTLsCFggJ6hPSP+EWhjy5rbdPPE6K3N4aAgAAGogCAAALngIAABiAAgAADfYCAAAHhgIAAMg2Q Date: Sat, 16 Sep 2017 13:20:28 +0000 Message-ID: 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> <1505555908.16316.5.camel@perches.com> <35f41984-22e9-5adc-0e4d-a4ef4204f6d7@windriver.com> <1505557061.16316.7.camel@perches.com> In-Reply-To: <1505557061.16316.7.camel@perches.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=jon.maloy@ericsson.com; x-originating-ip: [24.225.233.31] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DB5PR0701MB2008;6:bJhF8/Qte663DyQ/JxM5wrcFs8ZILdXqKGef+LuN35WMGCNucrMCenVESXwsx/ng88JTrDsEHf2nPOlCB+g5dvTqvUGzuKBPij8f/CZT5aQAVA/+P7Gjhz5gsqwZmRVT+TgdEW55aOQuaymf4RY/Z7J3/3VA9yCO9DwzO+7uVhkkQkwtW6mU9eExvByMfg2hnJIadyAm1mpkyK/vI/kj1u2NtWY3d3Kqkik9bP28wW88HL1sRa/K9kBmSc0JLiUvWt4rjjXWIgNx+SQR8pSlue1SvTXadt6PEC89CJUVYrVDgPowEoE/VH6diEcoEGgSMOt6Rx8MWmy/M/JrFUZ/oA==;5:Kt9VVaOBoY1tKXZNd6IWTJwLKqoUtM5snwhl6q6AD5QTSQU9fwcy51i5hxCBGFNmK803aHrJ1mTKDy6HE4W3HGWNfN8JIhJDkvFVYPCcJyuKafG2EuNx4ZO7cpv9HEuarICtBFWspAcV8TRcZjxE3w==;24:RcTCTKd1s8enAYRqj9A1EVrC9alwQ/jMPewt3yT2q/XvUxc1CInUdM3CyUor8DSeONvJAU3KeC78Y4gBuXaMb1juOX/0NUMwoLYW8HEafzs=;7:Bc9fac4HM98+vGWr2wXuSYle1Yk1uxZkQVQ8g9RlzhGxUkz7E+JIA41Rn05vU50yqDMeHfSZg+h9YVpz2nkg9tk03w9vOJUfyz1A2LymjZ57URRX16ZLF/SdoRGbtmKw7qVoQYTnEXKfmmdw0/vXKEU7OEYAdUhaLY9XNwCQHntYtklTGyBpAScoBsGUmNMmZ6/pFRVLKecs3mT/qiqmJcKFkCNVrtuGap1mpNgh9cA= x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: 234a853b-1564-4f30-6d69-08d4fd05b31a x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:DB5PR0701MB2008; x-ms-traffictypediagnostic: DB5PR0701MB2008: x-ld-processed: 92e84ceb-fbfd-47ab-be52-080c6b87953f,ExtAddr x-exchange-antispam-report-test: UriScan:(37575265505322)(143289334528602)(9452136761055)(788757137089)(42262312472803); x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(3002001)(93006095)(93001095)(100000703101)(100105400095)(10201501046)(6041248)(20161123562025)(20161123558100)(20161123555025)(20161123564025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:DB5PR0701MB2008;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:DB5PR0701MB2008; x-forefront-prvs: 0432A04947 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(6009001)(376002)(346002)(377424004)(377454003)(199003)(24454002)(13464003)(189002)(478600001)(53546010)(3660700001)(6116002)(102836003)(3846002)(3280700002)(68736007)(9686003)(229853002)(6436002)(316002)(6506006)(93886005)(14454004)(99286003)(55016002)(81156014)(8676002)(81166006)(5660300001)(189998001)(305945005)(74316002)(7736002)(8936002)(25786009)(2950100002)(7696004)(2906002)(76176999)(54356999)(97736004)(101416001)(105586002)(2900100001)(106356001)(33656002)(66066001)(86362001)(50986999)(53936002)(6246003)(2201001)(5250100002)(2501003);DIR:OUT;SFP:1101;SCL:1;SRVR:DB5PR0701MB2008;H:DB5PR0701MB1958.eurprd07.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Sep 2017 13:20:28.6662 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR0701MB2008 X-OriginatorOrg: ericsson.com X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrMKsWRmVeSWpSXmKPExsUyM2K7tK686t5Ig6fv+SzmnG9hsZh9/zGL xeVdc9gsji0Qs7i2YDqjxZbzWQ5sHltW3mTy2L3gM5PHvP+32Dy+rLrG7PF5k1wAaxSXTUpq TmZZapG+XQJXxoW//5gLnglVTG7naWB8xNfFyMkhIWAi8X7xDqYuRi4OIYEjjBINf+YygiSE BE4wShz7qAmSYBHoZZY4/OMqVNVcJonv/4+wQTjPGSX+HnwK1sImoCHxcloHI0hCROAek8TU LZuZQBLCAlYSm/eeYwOxRQSsJXp6DwEVcQDZURIf3gaDhFkEVCX+Lz/OAmLzCiRInNxwiwVi wX5mib2T/4PN4RQwllj5YRpYEaOAmMT3U2vA4swC4hK3nsxngnhIQGLJnvPMELaoxMvH/1hB djEKREqcfhoJEVaUOL9hEVSJrMSl+d2MEHYHu8TkqWEQtp7E1olvwc6UEPCVWHOVH+QcCYEn TBLtN5ugVulILL50BKrXRmJG93SomRUSW56cZIWw8yWWrvjIAtF8nlVi7bXpLBAJGYmDBxax T2DUnYXkBQhbR2LB7k9sELa2xLKFr5lngcNFUOLkzCcsCxhZVjGKFqcWJ+WmGxnrpRZlJhcX 5+fp5aWWbGIEJp2DW36r7mC8/MbxEKMAB6MSD+82ub2RQqyJZcWVuYcYJTiYlUR4m1WAQrwp iZVVqUX58UWlOanFhxilOViUxHkd912IEBJITyxJzU5NLUgtgskycXBKNTDyLrNq8hZcGD1j Akdc+oSzbate7Hqet1PPSX3j1blx0RNvHOmv+Fa1VnhlUdGfr3OOmXEo3mdU0zo1ddLRRZ22 kqcKOGMfTfhy6ugL3uLvNmE/f5nvmva0WntBM1eP8sfOywXprZ96l+U90hZhl33kHLGN7b7W p4THq60/v4p6pWob7HiVva9BiaU4I9FQi7moOBEAQIToFTYDAAA= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by nfs id v8GDZfr2019807 Content-Length: 2337 Lines: 55 > -----Original Message----- > From: netdev-owner@vger.kernel.org [mailto:netdev- > owner@vger.kernel.org] On Behalf Of Joe Perches > Sent: Saturday, September 16, 2017 06:18 > To: Ying Xue ; Thomas Meyer > ; Jon Maloy ; > netdev@vger.kernel.org; tipc-discussion@lists.sourceforge.net; linux- > kernel@vger.kernel.org; davem@davemloft.net > Subject: Re: [PATCH V2] tipc: Use bsearch library function > > On Sat, 2017-09-16 at 18:10 +0800, Ying Xue wrote: > > On 09/16/2017 05:58 PM, Joe Perches wrote: > > > 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. > > > > > > > Right, but probably we can tolerate the slight sacrifice here. > > What part of "very time critical" have you verified and benchmarked as > inconsequential? > > Please post your results. I agree with Joe here. This change does not simplify anything, it does not reduce the amount of code, plus that it introduce an unnecessary outline call in a place where we have every reason to let the compiler do its optimization job properly. ///jon