From koffice-devel Tue Aug 17 13:13:22 2010 From: zander () kde ! org Date: Tue, 17 Aug 2010 13:13:22 +0000 To: koffice-devel Subject: Re: design discussion: caching QTextFormat for faster text loading Message-Id: <201008171513.22460.zander () kde ! org> X-MARC-Message: https://marc.info/?l=koffice-devel&m=128205086722111 On Tuesday 17. August 2010 10.07.01 Jos van den Oever wrote: > > Notice that your assertion of many formats is not true; please write some > > test code to convince yourself :) > > If you are so sure, you should be able to explain it. I guess I can; it would be nice of you to put some time into the investigations when I ask you to; I'm trying to help you in your efforts by mentoring you as much as I can. You writing some code is in line with that. > > So I agree its the fastest to implement since it continues the current > > approach and just adds a cache on top. > > It adds many caches on top in a place where it does not belong. > > > As a besides I suggest you should take a little more care to not call the > > stuff I wrote 'uninsightful' without checking your facts. Either way, its > > not nice. > > I did not write that you mail was uninsightful, i wrote that the manner in > which styles are handled is uninsightful. Which is code I wrote and designed ;) > > Use my suggestion of a QMap doing this and connect to the QTextDocument > > destroyed signal to flush cache and you have a cache per document. > > This is very, very ugly. The style classes have no business knowing what > document they belong to or worse, when that document is loaded or > unloaded, let alone via an opaque mechanism like signals and slots. As I wrote before; don't see it as a document, see it as a key the size of a void* > They > should be concerned with holding style properties and converting them to > QTextFormat objects and that is all. By mixing in other concepts the code > becomes cluttered and hard to maintain. There is no such mixing if you don't get confused by the idea that the unique key for a format includes a QTextDocument pointer. > > > - minimizes the sizes of all QTextFormat instances by placing as much > > > style information in parent object (e.g. QTextFrame). > > Not needed; there is a minimum amount of them already. > > You say that again, but I'm not convinced. What do you consider minimum? I > would consider having only one QTextObject minimum. Is this also the case > in KPresenter? Talk is cheap; you don't accept my assertions, then write the 3 lines of code to prove it either way. :-) Here it is; http://pastebin.com/W17snq3s -- Thomas Zander _______________________________________________ koffice-devel mailing list koffice-devel@kde.org https://mail.kde.org/mailman/listinfo/koffice-devel