[Qt5-feedback] Real 64 Bit support ?
André Pönitz
andre.poenitz at nokia.com
Thu May 12 14:42:43 CEST 2011
On Thursday 12 May 2011 13:58:48 ext Keith Gardner wrote:
> I would also like to see this. On top of a 64-bit build, I would like to see
> the container classes (QVector, QList, etc...) have a qint64 to index the
> values instead of a qint32.
qint64 is expensive on (at least some) 32 bit machines.
Having _different_ sizes (32/64 bit) depending on architecture spoils
cross-platform data exchange using e.g. QDataStream. So that's even
less of an option.
Having 31 bit for sizes is definitely "good enough" for all kinds of
"mainstream" use cases.
For exceptional casew like "really needing more then 2 billion items in a
container" (and I had that myself...) QList/QVector are typically not suited
for other reasons (implicit sharing e.g).
So having qint64 indices will practically _hurt_ a lot of people and I would
not expect it to help anyone. So why change it then?
> > For what it worths, I totally second this: true 64bits support is a real
> > need, having to manage really huge datasets - here "huge" can mean
> > far more than 4GB.
On a quick glance, I think the limit can be raised to only affect the item
count, not the size by changing two lines in QVectorData::malloc and grow.
For 'double' data the size limit would be 16 GB then, and I am pretty sure
you would have switched to non-shared container long before that.
And to pre-empt the "int vs uint" debate. I don't have a strong opinion here.
On the "pro" side we have less typing, a safe way for "interating downwards",
the latter with the potential to safe a register when looping, and a way to
specify an "invalid" index (-1 is used for that in the Qt API commonly).
Also changing it would _silently_ break code that relies on "index < 0"
conditions.
On the "contra" side, it reduces "address space" by a factor of two, and
it's different from what the Standard Library does.
So I am leaning to the "leave-as-is" side here too, but not as strongly
as in the 32-vs-64 bit case.
Andre'
More information about the Qt5-feedback
mailing list