[v2][PATCH] Framework for performance benchmarking of functions

Florian Weimer fweimer@redhat.com
Thu Feb 14 09:06:00 GMT 2013


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.)

-- 
Florian Weimer / Red Hat Product Security Team



More information about the Libc-alpha mailing list