logo       

kabc question: msg#00383

kde.devel.pim

Subject: kabc question

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,
Today I took a closer look at the kabc code because I needed some more insight
to be able to write the abbrowser conduit for KPilot, and I noticed the
following (please correct me if I'm wrong):

Whenever one sets any of the attributes of an addresse (e.g. given name,
family name, title, note, email, address etc.), the KSharedPtr<AddresseeData>
gets cloned and the copy is assigned to mData again (ensuring that only the
data of that very Adressee is changed). The old data gets deleted (if
(!count--) delete this; in ksharedptr.h) and an exact copy is created
instead...
While this is fine for small changes in an addressee, when syncing a complete
addressbook (with >200 addresses) where each entry syncs about 10-20 fields,
this means 2000-4000 such cloning and reassigning operations in vain (of the
whole data structure: a.mData = new AddresseeData; *(a.mData) = *mData; this
copies all the data in the structure, doesn't it?), because just one for each
addressee at the beginning of the sync would also suffice. And even that
could be left out.

Can't we introduce a startNoDetach() and an endNoDetach() function to prevent
this kind of unnecessary copying from taking place? (or invent some other way
to set multiple data fields at once without detach()ing)

I don't know yet if this hurts performance in any way (just started rewriting
the abbrowser conduit), but I certainly don't like redundant operations being
done -- at some point they will sum up, and fast processors and memory are no
excuse (that's Java's way of thinking, and it shouldn't be KDE's).

Please enlighten me if I misunderstood something about KSharedPtr (this is
actually my first contact with that kind of idea, and I think it is a great
idea and has a lot of potential, good as well as bad potential if used in the
wrong way).


Reinhold

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE88oOeTqjEwhXvPN0RAviGAJ97s0Fh3LX4OI67EV6ENqcgRiC4bwCgshpS
xk3S/1bPFG3adgMEWu9uJYs=
=33+7
-----END PGP SIGNATURE-----
_______________________________________________
kde-pim mailing list
kde-pim@xxxxxxxxxxxx
http://mail.kde.org/mailman/listinfo/kde-pim
kde-pim home page at http://pim.kde.org/



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise