Re: Creating a byte[] of long size
Boris Punk wrote:
Is it not as simple as assigning int as 64 bit and long as 128 bit in newer
versions
That depends. For whom would it be simple, and for whom not?
How much legacy code are you willing to break?
What about folks who suddenly experience performance degradation
because their existing structures suddenly don't fit in on-chip cache
any more, whose programs are suddenly twice as large, and for whom
memory accesses overall suddenly take twice as long?
Whether they need the extra capacity or not?
Much safer would be the suggestions upthread of LongCollection classes
and perhaps a new "longarray" type.
There's no question that larger structures will be needed sometimes,
but the need will not be as widespread as some here appear to think.
The pressure to have more RAM on a machine, where 640K used to be
thought plenty and is now laughably microscopic, had nothing to do
with the size of int or much to do with the size of individual data
structures, but with the number of distinct structures and logic
contained within a program and the number of programs that must run
concurrently. Even with the clear need for gigabytes to terabytes of
RAM on machines today, pretty much none of that yet is for any
building-block data structure to exceed a gigabyte or two.
Even today, as pointed out upthread, Java is perfectly capable of
handling data structures that exceed 2 GB in size, just not in a
single array or int-based structure (or in 32-bit mode). You have to
go with multi-dimensional arrays or Collection<Collection> types of
structures, but they will work.
I predict that even when the need for multi-gigabyte arrays becomes
widely acknowledged that the actual use cases for them will remain
quite specialized. I venture to say further that the OP doesn't need
one yet.
--
Lew