Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2003:
[Freeciv-Dev] Re: (PR#2521) general effects framework
Home

[Freeciv-Dev] Re: (PR#2521) general effects framework

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: kaufman@xxxxxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#2521) general effects framework
From: "Raimar Falke" <rf13@xxxxxxxxxxxxxxxxx>
Date: Tue, 11 Mar 2003 12:33:46 -0800
Reply-to: rt@xxxxxxxxxxxxxx

On Tue, Mar 11, 2003 at 10:10:44AM -0800, Mike Kaufman wrote:
> On Tue, Mar 11, 2003 at 08:51:22AM -0800, Raimar Falke wrote:
> > Do you have numbers which show that this reduces the execution time?
> > Accessing them is not as cheap as you may think:
> > 
> > void g(int x)
> > {
> >   s.has.gov=x;
> > }
> > 
> > generates:
> >         movb 8(%ebp),%al
> >         andb $1,%al
> >         salb $6,%al
> >         movb s,%dl
> >         andb $191,%dl
> >         orb %al,%dl
> >         movb %dl,s
> > 
> > and
> > int g(void)
> > {
> >   return s.has.adv;
> > }
> > 
> >         movb s,%al
> >         salb $2,%al
> >         sarb $7,%al
> >         movsbl %al,%eax
> > 
> > A lot of instructions for an assignment. Using the bool type may increase
> > the cache pressure but may speed the execution up. I don't know which one is
> > faster but it isn't obvious to me that the bitfields are the better choice.
> 
> hmm. well, right now the struct uses 4 bytes. switching to unsigned char
> moves the number to 9 bytes (maybe 8 if can eliminate was_active).
> If I use bool, I need 36 bytes. That's unacceptable. made fc_bool an
> unsigned char and I'll use it. So for now, I'll change this to unsigned
> char as speed here is important.

fc_bool depends on your compiler. If your compiler chooses 32bit it is
your compilers decision. Complain to your compiler vendor.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "If at first you don't succeed... well so much for skydiving."




[Prev in Thread] Current Thread [Next in Thread]