From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.tuxdriver.com (charlotte.tuxdriver.com [70.61.120.58]) by dpdk.org (Postfix) with ESMTP id 854F65F24 for ; Fri, 23 Mar 2018 01:54:27 +0100 (CET) Received: from cpe-2606-a000-111b-40b7-215-ff-fecc-4872.dyn6.twc.com ([2606:a000:111b:40b7:215:ff:fecc:4872] helo=localhost) by smtp.tuxdriver.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1ezAyL-0002yc-FF; Thu, 22 Mar 2018 20:54:24 -0400 Date: Thu, 22 Mar 2018 20:53:49 -0400 From: Neil Horman To: =?iso-8859-1?Q?Ga=EBtan?= Rivet Cc: "Wiles, Keith" , "dev@dpdk.org" Message-ID: <20180323005349.GC16562@neilslaptop.think-freely.org> References: <20180322141037.GC6272@hmswarspite.think-freely.org> <20180322162751.z2kjkpjcg6aw76kk@bidouze.vm.6wind.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180322162751.z2kjkpjcg6aw76kk@bidouze.vm.6wind.com> User-Agent: Mutt/1.9.2 (2017-12-15) X-Spam-Score: -2.9 (--) X-Spam-Status: No Subject: Re: [dpdk-dev] [PATCH v2 04/18] eal: add lightweight kvarg parsing utility 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: Fri, 23 Mar 2018 00:54:27 -0000 On Thu, Mar 22, 2018 at 05:27:51PM +0100, Gaëtan Rivet wrote: > On Thu, Mar 22, 2018 at 10:10:37AM -0400, Neil Horman wrote: > > On Wed, Mar 21, 2018 at 05:32:24PM +0000, Wiles, Keith wrote: > > > > > > > > > > On Mar 21, 2018, at 12:15 PM, Gaetan Rivet wrote: > > > > > > > > This library offers a quick way to parse parameters passed with a > > > > key=value syntax. > > > > > > > > A single function is needed and finds the relevant element within the > > > > text. No dynamic allocation is performed. It is possible to chain the > > > > parsing of each pairs for quickly scanning a list. > > > > > > > > This utility is private to the EAL and should allow avoiding having to > > > > move around the more complete librte_kvargs. > > > > > > What is the big advantage with this code and the librte_kvargs code. Is it just no allocation, rte_kvargs needs to be build before parts of EAL or what? > > > > > > My concern is we have now two flavors one in EAL and one in librte_kvargs, would it not be more reasonable to improve rte_kvargs to remove your objections? I am all for fast, better, stronger code :-) > > > > > +1, this really doesn't make much sense to me. Two parsing routines seems like > > its just asking for us to have to fix parsing bugs in two places. If allocation > > is a concern, I don't see why you can't just change the malloc in > > rte_kvargs_parse to an automatic allocation on the stack, or a preallocation set > > of kvargs that can be shared from init time. > > I think the existing allocation scheme is fine for other usages (in > drivers and so on). Not for what I wanted to do. > Ok, but thats an adressable issue. you can bifurcate the parse function to an internal function that accepts any preallocated kvargs struct, and export two wrapper functions, one which allocates the struct from the heap, another which allocated automatically on the stack. > > librte_kvargs isn't necessecarily > > the best parsing library ever, but its not bad, and it just seems wrong to go > > re-inventing the wheel. > > > > It serves a different purpose than the one I'm pursuing. > > This helper is lightweight and private. If I wanted to integrate my > needs with librte_kvargs, I would be adding new functionalities, making > it more complex, and for a use-case that is useless for the vast > majority of users of the lib. > Ok, to that end: 1) Privacy is not an issue (at least from my understanding of what your doing). If we start with the assumption that librte_kvargs is capable of satisfying your needs (even if its not done in an optimal way), the fact that your version of the function is internal to the library doesn't seem overly relevant, unless theres something critical to that privacy that I'm missing. 2) Lightweight function seems like something that can be integrated with librte_kvargs. Looking at it, what may I ask in librte_kvargs is insufficiently non-performant for your needs, specifically? We talked about the heap allocation above, is there something else? The string duplication perhaps? > If that's really an issue, I'm better off simply removing rte_parse_kv > and writing the parsing by hand within my function. This would be ugly > and tedious, but less than moving librte_kvargs within EAL and changing > it to my needs. I don't think thats necessecary, I just think if you can ennumerate the items that are non-performant for your needs we can make some changes to librte_kvargs to optimize around them, or offer parsing options to avoid them, and in the process avoid some code duplication Neil > > -- > Gaëtan Rivet > 6WIND >