Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751256AbdIPKNU (ORCPT ); Sat, 16 Sep 2017 06:13:20 -0400 Received: from mail5.windriver.com ([192.103.53.11]:50374 "EHLO mail5.wrs.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751161AbdIPKNT (ORCPT ); Sat, 16 Sep 2017 06:13:19 -0400 Subject: Re: [PATCH V2] tipc: Use bsearch library function To: Joe Perches , Thomas Meyer , , , , , 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> From: Ying Xue Message-ID: <35f41984-22e9-5adc-0e4d-a4ef4204f6d7@windriver.com> Date: Sat, 16 Sep 2017 18:10:57 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <1505555908.16316.5.camel@perches.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [128.224.155.110] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1257 Lines: 35 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. >