On Monday, 17 de October de 2011 12:11:09 [email protected] wrote: > Aren't we now making things way to complicated?
Yes.
> If we go for storing the hash in the string as well, we can't do it in 16
> bytes, so 24 is our next best option on 32bit systems. How about a simple
>
> struct Data {
> QRefCount ref;
> int alloc;
> uint32 flags;
> uint32 hash;
> int size; // or end, depending on what's more convenient
> qptrdiff begin;
> }
>
> This gives 24 bytes on 32bit systems, 32 on 64bit. The hash stays 0 for
> compile time strings.
Right. On 64-bit systems, there's a 4-byte padding before "begin", but I guess
that is intentional.
> Another option we discussed earlier (at least for QString and QByteArray
> was to remove the fromRawData() functionality. In that case we could
> simply do:
[snip]
I'd prefer the above option though. Your solution also removes the prepend
optimisation.
Even though QString("hi") has 4 bytes of payload and 24 (32) bytes of overhead
-- 85.7% (88.8%).
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Software Architect - Intel Open Source Technology Center
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Qt5-feedback mailing list [email protected] http://lists.qt.nokia.com/mailman/listinfo/qt5-feedback
