🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c.moderated
Article #2454

Re: Efficiency Question : bits vs. bytes (or anything else, for that matter)

#2454
From: richard mross
Date: Tue, 02 Apr 1996 01:54
24 lines
1294 bytes
vjarnot@mnw.net (Asmodeus) wrote:


>I have set up an array in the following manner (obviously I just need
>0 or 1) :

>typedef struct my_bits {
>	unsigned the_bit : 1;
>};

>my_bits the_array[800][800];

>	My question is this : I have read that some operations ( =,+,- are
>what I use) are slower when performed on bits as opposed to other
>types.  My objective is to optimize the code for speed, and I figured
>using less memory would help me do so, now I'm having doubts.  So what
>is more efficient, bits or some other type???

>				Thanks in advance for your help.


compile both cases with the "generate assembly output file"  option
and compare the assemply output, then count the cpu cycles for each of
the instructions used on each of the outputs
Technical Details
Message-ID: <4jq1dc$a1g@solutions.solon.com>
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
References: <4jbciv$2kk@solutions.solon.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
From: uar@southwind.net (richard mross)
Newsgroups: comp.lang.c.moderated
Subject: Re: Efficiency Question : bits vs. bytes (or anything else, for that matter)
Date: 1 Apr 1996 19:54:52 -0600
Organization: SouthWind Internet Access, Inc.
Sender: clc@solutions.solon.com
Approved: clc@solutions.solon.com
Message-ID: <4jq1dc$a1g@solutions.solon.com>
References: <4jbciv$2kk@solutions.solon.com>
NNTP-Posting-Host: solutions.solon.com
X-Newsreader: Forte Free Agent 1.0.82