Re: What is better?
- From: "Mike Williams" <Mike@xxxxxxxxxxxxxxxxx>
- Date: Mon, 9 Jan 2006 18:12:17 -0000
"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
.
- References:
- What is better?
- From: Jack
- What is better?
- Prev by Date: RE: Sending Lotus Notes Mail from Access - Bypassing Password
- Next by Date: Re: Break Mode Not Run
- Previous by thread: Re: What is better?
- Next by thread: Re: What is better?
- Index(es):
Relevant Pages
|
Loading