|
Quick Lists
|
|
Bug ID:
|
4963452
|
|
Votes
|
45
|
|
Synopsis
|
RFE: 64 bit pointers needed
|
|
Category
|
java:specification
|
|
Reported Against
|
1.4.1
, 1.4.2
|
|
Release Fixed
|
|
|
State
|
6-Fix Understood,
request for enhancement
|
|
Priority:
|
4-Low
|
|
Related Bugs
|
4850923
,
4880587
,
4088441
|
|
Submit Date
|
04-DEC-2003
|
|
Description
|
A DESCRIPTION OF THE REQUEST :
As per the Java Language Specification, section 10.4, all array access in Java is done by using an int as index. Since an int is a signed 32bit value, this limits the total number of addressable elements of an array to 2**31 (about 2 billion). It should be possible to address an array using 64bit values.
JUSTIFICATION :
While having access to 2 billion entries may seem sufficient, there are very compelling performance reasons to be able to use more in a single array. As an example, consider a square n*n matrix, stored as an array (either row or column major, doesn't matter which). Since an array stores at most 2**31 entries, this means that n=sqrt(2**31)=46341, thus the matrix cannot be very large. For multidimensional arrays this is an even more severe limitation (3d Tensors could at most be of size 1290).
A workaround is to use an array of arrays (ie. double[][]). However there is no guarantee that successive rows will be laid of linearly in memory, and therefore performance may be severly penalized. Experimentally, performance may suffer by a factor of over 2, often far greater.
Also, most existing matrix packages (ie. LAPACK) assumes linear storage, and are thus incompatible with a double[][] storage (requires double[]). Calling a LAPACK routine with a jagged storage thus requires extra array copying and memory allocation, and can further decrease performance and increase memory requirements.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
It should be possible to address arrays using 64bit integers (long?), as this provides a seamless transition for users of 64bit computers.
ACTUAL -
Cannot address more than 2**31 elements of an array.
CUSTOMER SUBMITTED WORKAROUND :
Use of array of array constructs (use double[][] instead of double[])
(Incident Review ID: 227911)
======================================================================
Posted Date : 2006-11-20 20:56:47.0
|
|
Work Around
|
N/A
|
|
Evaluation
|
Fair enough.
Posted Date : 2006-11-20 20:56:47.0
|
|
Comments
|
Submitted On 07-DEC-2003
bjornoh
It seems Microsoft .Net allows both int and long to access
arrays, and it even has an unsigned long, which means 2**64
elements can be used.
Submitted On 04-MAY-2005
sebastiano.vigna
We use extensively arrays in MG4J, and presently the only obvious limit of our architecture is 2^31 documents. This may seem large, but Google already indexes four times that number of pages, so it is actually quite small. Please, give us arrays with long indices.
Submitted On 25-NOV-2007
This also limits the size of memory mapped files, and to work around you need to intercept every single array access.
Submitted On 01-JUL-2009
rhuddusa
and stop making interfaces with int indexed things, like CharSequence ... with charAt and length functions which are int based
PLEASE NOTE: JDK6 is formerly known as Project Mustang
|
|
|
 |