From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 510981B705 for ; Tue, 24 Oct 2017 02:18:33 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Oct 2017 17:18:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,424,1503385200"; d="scan'208";a="1234363812" Received: from fyigit-mobl1.ger.corp.intel.com (HELO [10.241.225.136]) ([10.241.225.136]) by fmsmga002.fm.intel.com with ESMTP; 23 Oct 2017 17:18:31 -0700 To: Gaetan Rivet , dev@dpdk.org References: <1504023588-13085-1-git-send-email-gaetan.rivet@6wind.com> From: Ferruh Yigit Message-ID: Date: Mon, 23 Oct 2017 17:18:31 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <1504023588-13085-1-git-send-email-gaetan.rivet@6wind.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH] bus: skip useless iterations in rte_bus_find X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Oct 2017 00:18:33 -0000 On 8/29/2017 9:19 AM, Gaetan Rivet wrote: > The starting point is known. The iterator can be directly set to it. > > The function rte_bus_find can easily be used with a comparison function > always returning True. This would make it a regular bus iterator. > > Users doing so would however accomplish such iteration in > > O(N * N/2) = O(N^2) > > Which can be avoided. > > Signed-off-by: Gaetan Rivet > --- > > In practice, such cost is entirely negligible of course. > It is cleaner and more correct though. +1 for more clean approach Reviewed-by: Ferruh Yigit