Re: I don't like the intro page of the documentation.
- Posted by jimcbrown (admin) Jun 07, 2013
- 2687 views
"Use the integer data-type (a special case of the atom) when speed and low memory use are important."
Clarification: In Euphoria, there is no size advantage to using a integer over an atom. Atoms which are within the integer range (and have no fractional part) take up the same amount of space.
This is incorrect.
Yeah, I was going to say this too, but I re-read Jay's post again, and he is correct though might benefit from rewording. Jay is saying that assigning integer values to an 'atom' variable takes up no more space than assigning it to an 'integer' variable.
IIRC there is a case, new to 4.0, where this is not true any longer. That is with autopromotion - when you attach a delete routine to an integer, it is promoted into the full floating point format (and thus taking up all that extra space) so it can safely store the information for the delete routine - even though the actual value would otherwise fit into a normal integer. std/eumem.e is affected by this. (Regex works similarly, though on 32bits the values would be addresses requiring a full atom anyways.) I think this applies even if the variable is explicitly declared as an integer rather than an atom.
But in the normal case, jaygade is correct.