[Freeciv-Dev] Re: (PR#2521) general effects framework
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
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.
-mike
- [Freeciv-Dev] (PR#2521) general effects framework, Mike Kaufman, 2003/03/10
- Message not available
- [Freeciv-Dev] Re: (PR#2521) general effects framework, Raimar Falke, 2003/03/11
- [Freeciv-Dev] Re: (PR#2521) general effects framework, Mike Kaufman, 2003/03/11
- [Freeciv-Dev] Re: (PR#2521) general effects framework, Raimar Falke, 2003/03/11
- [Freeciv-Dev] Re: (PR#2521) general effects framework, Mike Kaufman, 2003/03/11
- [Freeciv-Dev] Re: (PR#2521) general effects framework, Raimar Falke, 2003/03/11
- [Freeciv-Dev] Re: (PR#2521) general effects framework,
Mike Kaufman <=
- [Freeciv-Dev] Re: (PR#2521) general effects framework, Raimar Falke, 2003/03/11
- [Freeciv-Dev] Re: (PR#2521) general effects framework, rwetmore@xxxxxxxxxxxx, 2003/03/11
- [Freeciv-Dev] Re: (PR#2521) general effects framework, Raimar Falke, 2003/03/12
- [Freeciv-Dev] Re: (PR#2521) general effects framework, rwetmore@xxxxxxxxxxxx, 2003/03/12
- [Freeciv-Dev] Re: (PR#2521) general effects framework, Raimar Falke, 2003/03/13
|
|