From: Thomas Hurst Date: 2007-12-29T11:28:08+09:00 Subject: Re: testing for 64-bit environment * Koni Marti (KMarti@gmx.ch) wrote: > Isn't it a huge wast of memory resources to store every number in 8 > bytes? I think about counters or other occasions where 8 bytes are way > too much for simple scripts. This may extremely hamper the > performance. Unless you've got so many of them that you're swapping, no. And if you do have that many, and really really want endless millions of small numbers, maybe it's time to look at RubyInline or a C extension where you can just do uint16_t bla[2000000000]. Depending on what you're doing, such things have doubtless already been written. > Is there a way to specify the number of bytes for representing numbers? > Otherwise, it would be useful to extend the Fixnum functionality for that > feature; what do you think? For performance/storage, not really possible; Fixnums are, as I understand it, stored directly in a (VALUE *), which is the base type for all Ruby objects. Note these are pointers; hence, native word size, and thus 8 bytes on 64bit systems. Of course, the entire point of native 64bit is that they're fast at 64bits, so I wouldn't worry too much about it. -- Thomas 'Freaky' Hurst http://hur.st/