This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [v2][PATCH] Framework for performance benchmarking of functions
- From: Siddhesh Poyarekar <siddhesh at redhat dot com>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Fri, 15 Feb 2013 17:51:06 +0530
- Subject: Re: [v2][PATCH] Framework for performance benchmarking of functions
- References: <20130108093115.GA27464@spoyarek.pnq.redhat.com><20130111065846.GC16859@spoyarek.pnq.redhat.com><511CA91C.6000306@redhat.com>
On Thu, Feb 14, 2013 at 10:06:36AM +0100, Florian Weimer wrote:
> On 01/11/2013 07:58 AM, Siddhesh Poyarekar wrote:
>
> >+if ($#ARGV lt 1) {
> >+ die "Usage: bench.pl <function> <iterations> [parameter types] [return type]"
> >+}
>
> This should be:
>
> if (@ARGV < 2) {
>
> @ARGV in a scalar context results in the array length, and I think
> it's more idiomatic than $#ARGV (which evaluates to the index of the
> last element). You compare numbers, so you should use </>/== instead
> of lt/gt/eq (which are for strings). If there are more than 10
> arguments, this is not just style issue because 10 lt 2 is true,
> while "10" < "2" is not.
>
> (Similar issues follow.)
Thanks, I'll work on fixing these next week.
Siddhesh