develooper Front page | perl.perl5.porters | Postings from April 2006

Re: [PATCH] is_list_assignment speedup

Thread Previous
From:
Nicholas Clark
Date:
April 16, 2006 10:28
Subject:
Re: [PATCH] is_list_assignment speedup
Message ID:
20060416172812.GI32132@plum.flirble.org
On Fri, Apr 14, 2006 at 09:58:01PM -0500, Andy Lester wrote:
> It seems that because o->op_type is a bit field, it saves a good number
> of instructions, and probably speed, to cache its value in a native
> unsigned before doing a lot of comparisons.  Plus we save a lot of
> pointer indirects.

Having attempted to outsmart the compiler's code generator before, I'm
coming to the conclusion that it's actually very hard to make a win.

on x86 gcc with -O2 your patch gives a 64 byte saving:

-rw-rw-r--  1 nick nick 100080 avr 16 19:01 op.o
-rw-rw-r--  1 nick nick 100144 avr 16 19:00 op.o.orig

on x86 gcc with -Os it gives 12 bytes:

-rw-r--r--  1 nwc10  nwc10  77628 Apr 16 18:02 op.o
-r--r--r--  1 nwc10  nwc10  77640 Apr 16 17:06 op.o.orig

on Sun's sparc compiler with -O it gains -48 bytes

-rw-r--r--   1 nick     other     124676 Apr 16 10:22 op.o
-r--r--r--   1 nick     other     124628 Apr 16 10:14 op.o.orig

(which surprised me. I'm not sure why this is)

I'm aware you've sent a followup patch, so I'm not going to apply this one.

Nicholas Clark

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About