[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice-devel
Subject:    Re: Proposal to replace Value by QVariant (Re: koffice/kspread)
From:       Stefan Nikolaus <stefan.nikolaus () kdemail ! net>
Date:       2007-10-17 11:18:32
Message-ID: 200710171318.43828.stefan.nikolaus () kdemail ! net
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


On Wednesday, 17. October 2007 11:51:39 Thomas Zander wrote:
> On Wednesday 17 October 2007 11:12:54 Stefan Nikolaus wrote:
> > KSpread::Value is used a lot and the last time I've checked it was more
> > lightweight as QVariant.
>
> Hmm, reading the source code I'm not so sure about that statement;
>
> QVariant takes 32 bits plus one pointer (32 or 64 bits depending on
> architecture).
> 32 bits as members, and the pointer in the union.

It also takes a d-pointer, but which is not shared generally (the shared 
pointer is part of the union in the private. Don't know what trick hides 
behind this. Sharing only if necessary or only complex types?)

> KSpread::Value takes one (d)pointer, 8 bits and another pointer.
> the dpointer is QSharedDataPointer<Private> d;
> 8 bits as members, and the pointer in the union.
>
> This means that the kspread one takes more memory then the qvariant one,
> upto 8 bytes more.

You're refering to the d-pointer you missed for QVariant. Not because of that, 
but maybe it takes more, due to the fact, that Value always shares the data, 
a QAtomic (an integer?) is always occupied.

A quick check gives me (AMD64):
kspread(17556) KSpread::Value::Value: sizeof(QVariant)= 16
kspread(17556) KSpread::Value::Value: sizeof(QVariant::Private)= 16
kspread(17556) KSpread::Value::Value: sizeof(Value)= 16
kspread(17556) KSpread::Value::Value: sizeof(Value::Private)= 16

Either way, if you think, it's worth the effort for whatever reason go ahead. 
I don't mind.

> On
> the other hand, I have some faith in the hackers-capabilities of the Trolls
> ;)

Hmm, knowing one of the new trolls I'm not so sure about that statement; ;)

-- 
Regards,
Stefan

["signature.asc" (application/pgp-signature)]

_______________________________________________
koffice-devel mailing list
koffice-devel@kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic