Details
-
Task
-
Resolution: Unresolved
-
P4: Low
-
None
-
None
-
None
Description
Now that QTBUG-102465 has fixed QXmlStreamReader's int/qsizetype mismatches (incl. some bugs), the central Value struct is now
{ qsizetype pos; // 8 bytes qsizetype len; // 8 bytes qint16 prefix; // 2 bytes ushort c; // 2 bytes // ======== // 20 bytes }
The prefix is only used for names, for which fastScanName() imposes an upper limit of 4096 on the length, in which case a qint16 len would suffice, too.
For character content, which can reasonably be expected to run for more than 2Gi character, OTOH, there's no need for a prefix (TODO: check c).
Finally, when c is used, len is always 1 and prefix is 0 (TODO: check that's correct).
So we should be able to save some space by adding variadic members to Value:
{ qsizetype pos; // 8 bytes - can't be helped union { struct { qsizetype len; // 8 bytes } characters; struct { qint16 len; // 2 bytes qint16 prefix; // 2 bytes } name; ushort c; // 2 bytes }; // 8 bytes // ======== // 16 bytes }
which brings us back to where we were in Qt 5 with struct Value {int, int, int, ushort} (14 bytes + 2 padding).
If it's not clear by context which kind of Value we have, we also need to embed a discriminator, which would be easy in 64-bits (use some bits from pos), but may be tricky in 32-bit (where we really only have one bit to spare in pos - the sign bit).
Attachments
Issue Links
- relates to
-
QTBUG-134479 Qt XML Backlog Cleanup
-
- In Progress
-
- resulted from
-
QTBUG-102465 Finish migration to qsizetype [QXmlStreamReader]
-
- Closed
-