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

Siddhesh Poyarekar siddhesh@redhat.com
Fri Feb 15 12:20:00 GMT 2013


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



More information about the Libc-alpha mailing list