Re: What is better?



"Jack" <replyTo@newsgroup> wrote in message news:%23j8wP1TFGHA.344@xxxxxxxxxxxxxxxxxxxxxxx

Is it more efficient to declare variable as a Byte, when
variable can have only 2 values: 0 and 1, or with recent
computers it should be declared as Long?

It depends what you mean by "more efficient". If you mean what will use the least memory then of course a Byte will use much less than a Long. However, if that's what you mean (memory efficient) then it would be better to use just a single "bit" for a boolean value (0 or 1). You can hold eight separate "bits" in a byte, and 32 separate "bits" in a Long.


However, if you are talking about the most efficient in terms of speed (and if you are talking about variables in VB) then the "native" data lenght is the most efficient (which on modern 32 bit computers is 32 bits, or a Long). Pretty soon though that will change (on 64 bit machines).

Mike


.



Relevant Pages

  • RE: short answer to technical question?
    ... address for memory, and cannot address as much memory as a 64 bit ... In the case of the IBM mainframe computers, the natural word used to be ... 64 bit machines, using all 64 bits of an address to address memory. ... Modern PC style computers all are binary. ...
    (Fedora)
  • Re: Breaking Large Composite Numbers...???
    ... efficient procedure on today's computers. ... NFS does compute congruences. ... And memory is also quite cheap these days! ... Think about "market demand" for such machines. ...
    (sci.crypt)
  • Re: death of the mind.
    ... >> vision of science is the sterile state of their explanatory theories. ... engages in the behavior said to "show memory." ... > computers aren't animals and probably aren't like them in very many ways. ... And I've published inferential statistics when forced to - which was most of ...
    (sci.cognitive)
  • Re: Custom Form Memory Hole?
    ... > with their own custom form. ... > certain machines open or create a new item using these custom forms - the ... > 300K of memory up to using 200MB of memory, ... two WinXP computers (one of which is affected, ...
    (microsoft.public.office.developer.outlook.forms)
  • Re: self-extracting diskette image to hard disk? (or, IBM keeping inexpensive supercomputers awa
    ... >> also have brought in huge amounts of money, ... > I know what IBM was doing, ... >> claiming not only that memory would be many times larger than existing ... >> selling these super computers for $3000. ...
    (comp.os.os2.misc)

Loading