From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from na01-by2-obe.outbound.protection.outlook.com (mail-by2on0143.outbound.protection.outlook.com [207.46.100.143]) by dpdk.org (Postfix) with ESMTP id 906193775 for ; Tue, 12 May 2015 00:29:08 +0200 (CEST) Received: from CY1PR0101MB0987.prod.exchangelabs.com (25.160.224.149) by CY1PR0101MB0985.prod.exchangelabs.com (25.160.224.147) with Microsoft SMTP Server (TLS) id 15.1.160.19; Mon, 11 May 2015 22:29:04 +0000 Received: from CY1PR0101MB0987.prod.exchangelabs.com ([25.160.224.149]) by CY1PR0101MB0987.prod.exchangelabs.com ([25.160.224.149]) with mapi id 15.01.0160.009; Mon, 11 May 2015 22:29:04 +0000 From: Don Provan To: Ravi Kerur , "Ananyev, Konstantin" Thread-Topic: [dpdk-dev] [PATCH v2] Implement memcmp using AVX/SSE instructions. Thread-Index: AQHQjCue2tVdDpGZrEKjemZ91u35+Z13UjoQ Date: Mon, 11 May 2015 22:29:04 +0000 Message-ID: References: <1431119946-32078-1-git-send-email-rkerur@gmail.com> <1431119989-32124-1-git-send-email-rkerur@gmail.com> <2601191342CEEE43887BDE71AB9772582142E106@irsmsx105.ger.corp.intel.com> <2601191342CEEE43887BDE71AB9772582142E44A@irsmsx105.ger.corp.intel.com> <2601191342CEEE43887BDE71AB9772582142E475@irsmsx105.ger.corp.intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: gmail.com; dkim=none (message not signed) header.d=none; x-originating-ip: [209.234.132.35] x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0101MB0985; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(5005006)(3002001); SRVR:CY1PR0101MB0985; BCL:0; PCL:0; RULEID:; SRVR:CY1PR0101MB0985; x-forefront-prvs: 05739BA1B5 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(6009001)(377454003)(5001770100001)(50986999)(189998001)(106116001)(74316001)(76176999)(33656002)(2900100001)(2950100001)(66066001)(46102003)(19580395003)(122556002)(92566002)(40100003)(19580405001)(86362001)(102836002)(2656002)(93886004)(77156002)(54356999)(62966003)(5001960100002)(87936001); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR0101MB0985; H:CY1PR0101MB0987.prod.exchangelabs.com; FPR:; SPF:None; MLV:sfv; LANG:en; Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: bivio.net X-MS-Exchange-CrossTenant-originalarrivaltime: 11 May 2015 22:29:04.2149 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 8731bc55-0e76-4eb7-ae4b-401e56037945 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0101MB0985 Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH v2] Implement memcmp using AVX/SSE instructions. X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 May 2015 22:29:09 -0000 I probably shouldn't stick my nose into this, but I can't help myself. An experienced programmer will tend to ignore the documentation for a routine named "blahblah_memcmp" and just assume it functions like memcmp. Whether or not there's currently a use case in DPDK is completely irrelevant because as soon as there *is* a use case, some poor DPDK developer will try to use rte_memcmp for that and may or may not have a test case that reveals their mistake. The term "compare" suggests checking for larger or smaller. If you want to check for equality, use "equal" or "eq" in the name and return true if they're equal. But personally, I'd compare unless there was a good reason not to. Indeed, I would just implement full memcmp functionality and be done with it, even if that meant using my fancy new assembly code for the cases I handle and then calling memcmp itself for the cases I didn't. If a routine that appears to take an arbitrary size doesn't, the name should in some manner reflect what sizes it takes. Better would be for a routine that only handles specific sizes to be split into versions that only take fixed sizes, but I don't know enough about your use cases to say whether that makes sense here. -don provan dprovan@bivio.net -----Original Message----- From: Ravi Kerur [mailto:rkerur@gmail.com]=20 Sent: Monday, May 11, 2015 1:47 PM To: Ananyev, Konstantin Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH v2] Implement memcmp using AVX/SSE instructi= ons. ... Following memcmp semantics is not hard but there are no use-cases for it in= DPDK currently. Keeping it specific to DPDK usage simplifies code as well. I can change the name to "rte_compare" and add comments to the function. Will it work? ...