Tag Archives: coding

On moving and d-pointer performance

Edit: fixed links… sigh, I should switch to wordpress

The usual thing, long time no blogging. Well, real life got a good deal in the way. Not for bad though. While I did my MSc. thesis at KDAB I got the possibility to start an Ph. D. position on information visualization at ILOG (now part of IBM) in Paris. This meant packing our stuff from our Berlin apartment (not too much luckily as we rented furnished) and moving it back to the Netherlands at first. Then using the next couple of months to sort out and pack our remaining stuff which we didn’t take to Berlin and find an apartment in Paris. As you probably can imagine, this was slightly stress-full, but I’m pleased to say that we are finally settled now. We have a nice apartment south of Paris, only a 20 min walk from the office I work and we have Internet access again The only thing we don’t have yet is the ability to understand french…. Well, lets see if that changes over time.

What triggered me to write this blog was something different though. First a note of warning, I didn’t do any other research than presented in the remaining of this writing. My former colleague Marc wrote two great articles (here and here) on the topic of d-pointers. Its in German, though it shouldn’t be too hard to read if you’re somewhat familiar with the topic and German. One topic he doesn’t address though (or I skimmed too fast now, it was some time ago I really read them) is the performance of d-pointer classes versus value classes. Recently I was writing a class which has the potency of getting created a lot and often which triggered the question where and how much the cost difference would be. We all know that creating objects on the heap is more expensive than creating them on the stack, so I quickly deduced from this that d-pointer classes must be more expensive. Okay, that shouldn’t have come as too much of a surprise. Two questions remain though, what is the price one pays and where (e.g. creation, copy, access).

Intrigued by these questions I set up a real quick and dirty benchmark just to get some rough ideas. By no means I pretend to be complete and given that I’m quite tired I might have made some horrible mistakes as well. So feel free to comment on the results. Here’s what I did: I created three different classes: DPointerClass, ValueClass and InlineValueClass (the latter just for additional comparison). The classes are very simple, they just hold an int which you can get (const access) and set (non-const access). Complete source can be found here. Next I created a test class using QTest lib with the following methods:

  • void test${Class}CreateDestruct();
  • void test${Class}HeapCreateDestruct();
  • void test${Class}Copy();
  • void test${Class}Assignment();
  • void test${Class}ConstAccess();
  • void test${Class}NonConstAccess();

In these methods I use the QBENCHMARK macro to benchmark the actions described by the test names (using walltime). This leaded to the following results:

In this image you see the number iterations for each action. To be honest, when seeing that graph I’m not completely sure how to interpret it. As I understand from the QTest doc, for walltime a higher number of iterations might be needed to get more precise results. However, what more precise results mean is not clear to me and neither why there is such a big variation in the number of iterations per tests for the individual classes as well as between all tests. (E.g. for value it is high for the CreateDestruct test, low for HeapCreateDestruct and again high for Copy). Well I guess the second issue is closely related to the first one so if anyone could enlighten me on that It’d be great.

Secondly, and slightly more interesting is the following graph:

Here you see the time (in msec) it took per iteration. We can directly conclude that for creation/destruction and copying the difference is significant. For assignment and the access operations the difference is negligible. So the extra step of indirection doesn’t seem to add, more strangely it seems to be slightly faster even. The factors between DPointer and Value for CreateDestruct, HeapCreateDestruct and Copy are respectively 42, 20 and 12  20, 42 and 12.

Concluding we can say that only for CreateDestruct, HeapCreateDestruct and Copy the differences are significant. For creation this is logical, for copying I assume that the byte-by-byte copying from the default constructors are performing slightly better than custom ones. For assignment and access there is no performance loss. One last question remains, although the difference is significant even in the worst case we’re talking about 0.0012 msec. How does one determine whether this is too much for his application and thus fall back to creating classes with private members? The class I’m working on has the potention of getting created in large amounts in short time (e.g. 100.000 several times in a number of consecutive calls)  I’m somewhat tempted at the moment to move away from value classes to d-pointer classes for the obvious design reasons as the class will become part of a library. Any comments and thoughts on this are welcome. Continue reading

Tagged , , | 13 Comments

All good things come to an end….

even so KPilot. After having been part of KDEPIM for years it has been moved to tags/unmaintained/4/kpilot today. For months now no real development happened, there was not even bug fixing. I guess we have to draw our conclusions from that. Jason already said he lost his interest after buying a new phone about a year ago, while I myself still do have a palm I actually don’t use it anymore. KPilot has been a fun ride for me. Adriaan de Groot once dragged me in when I requested a new feature. It where my first in KDE software development. It showed me the trickeries of syncing pim data between two devices and it got me in touch with Akonadi. I even think it was one of the first pim applications to make use of Akonadi. So this means that from KDE SC 4.4 on users won’t be able anymore to sync there palm with the PIM suite again. I’m sorry for the inconvenience for those who still did (I did see a bug report coming up every now and than). If anyone is still interested in getting it up and running again, the code can be checked out via svn co svn://anonsvn.kde.org/home/kde/tags/unmaintained/4/kpilot I’d like to thank Adriaan and Jason for guiding me on my first steps. For the fun time we’ve had working on KPilot or whining about the pity state of device synchronization on Linux in general (still today it seems that there’s not really a rock solid solution available). I’d also like to thank Robert and Doug for their contributions and of course the people who started KPilot in the first place like Dan Pilone and Rainhold Kainhofer. We’ll have to see what the future brings. But with all those new powerful devices, which are able to access various groupware solutions I doubt if anyone wants to really invest in a computer <-> phone/handheld solution. The curtain falls for KPilot, good bye old friend, fare well! Continue reading

Tagged , , | 20 Comments

Help us testing KPilot using your n810/n800/n770

Dear lazyweb (at least the KDE part of that, having an n810 Garnet VM supported device),

I just heard from Jason “vanRijn” Kaspaer that there is a VM for the n810 which makes it possible to run Palm applications on your n810. I just gave it a try and its just awesome! When you install the VM you instantly have the addressbook, calendar and todo applications available. As these are currently the only supported applications in KPilot this should be enough ;) . I tried to install, configured kpilot, pressed the hotsync button in the VM and guess what? It just seem to work. So how to turn your n810 in a PIM device which can be synced against trunk?

  1. Goto: Garnet VM and download the GVM on your n810 (mind you, you need to register).
  2. configure KPilot to look for device: net:any (kpilot -s -> General Setup -> Device -> Pilot Device
  3. Make sure you have some valid resource configured for the conduit you want to test (Note: first try to create a new resource in Akonadi and don’t use your production resources. Note 2: Don’t tell me I didn’t warn you. Note 3: If you use the resource bridge of Kevin Krammer you can even add it to the kde PIM like kaddressbook.)
  4. start adding some items on one or both sides
  5. Start KPilot
  6. press the hotsync button in the GVM (Note: you have to leave the specific application e.g. addressbook to see that button).

That’s it, happy syncing :)

If you have Issues please let us know and no, no screen shots today. Try out yourself! For issues please drop by in #kpilot, #kontact or #akonadi (whatever is most appropriate for the issue).

Update: Of course this works for every Nokia device that is supported by the Garnet VM. Thanks Lynoure Braakman for pointing out my narrow mindedness on this point =:). Continue reading

Posted in coding | Tagged , , | 7 Comments

OpenSync meeting in Berlin

This weekend I have been in Berlin at the KDAB office to meet with the OpenSync guys. I arrived Friday at around 20:00 in a really nice atmosphere. Volker and Tobias where already there as well as some OpenSync guys. Volker had enlightened the OpenSync guys about Akonadi by the time I arrived. We went for a dinner first and after that we got an introduction of OpenSync from Daniel Gollub. They are currently working on a new release so there’s a lot of API breaking going on currently. However most of the functionality seems to get in shape right now.
As a side note, breaking API seems to be part of their regular development work. I really hope that they can get to some stable API which won’t change with every release they do. This issue seems to be a bit of a pain currently.
I gave a short talk about the current status of KPilot and we looked a bit what OpenSync could mean for KPilot. It became (again) clear that KPilot has a couple of features for which OpenSync is really not designed. However the baseconduit framework I created is quite like OpenSync (at least in the functionality it has, the designs differ some). Currently I’ll not start on integration of OpenSync into KPilot because what we have now is working reasonably well. When however KitchenSync is ported to the new API and the opensync palm plugins too, then I might give it a try to delegate the actual syncing to KitchenSync/OpenSync.
Volker started working on an OpenSync Akonadi plugin. The basic code is already there but unfortunately not yet very useful due to missing/not working functionality in the OpenSync library.
Further more we got a lot of information from Michael Bell, who is working on the libsyncml library. He gave us a nice overview of the architecture and also a guide to get started. The guide contained a lot of details and pitfalls, so much that I loosed track a bit. Well I guess that’s the other side of the coin when you want to support every device out there.
All in all, it was a great atmosphere, really good coffee, a lot off cookies, a lot of hacking, a lot of strange music coming from the streets, a lot of good food and a lot of fun!

On the KPilot front: I’m currently working on a “not so nice thing to do”. Cleaning up the huge amount of krazy warnings. This is kind a dull job but it is annoying me for ages now. Currently KPilot is not the black sheep of kdepim anymore but I want to get that number as low as possible (0 preferably). I also still have some items on my to do list regarding the Akonadi code and the base framework. Hope I can get to that soon. Continue reading

Posted in coding | Tagged , , | 7 Comments

Wrapping up: GSoC and Akademy are over already.

Akademy is over, GSoC is over, so finally some time to cool down =:). Well, I guess this is more a sign that real life will take over very soon again. Within a week or two the college year will kick off and whatever more. However, I really have had a great time. It was again a real pleasure to work with vanRijn on my summer of code project. Like him I also am very pleased with the results of the summer of code. As mentioned earlier there is still some polishing left to do but I think that KPilot is in a reasonable good shape right now.

I cannot do anything else than confirm all the positive feedback given on Akademy. It was the second time I attended but this year it was just awesome! So much interesting talks, great ideas and wide visions for KDE. I also really enjoyed meeting all those cool people. It was just great to discuss code, problems in the Banlieus of Paris, eating habits, funny things in spoken language and what not more. So thank you Armin, Alex, Andre, David, Kevin, Patrick, Volker, Thomas and all of you who I have spoken but who I don’t remember right now. I truly enjoyed!

Akademy has got a tail for me as I was invited to join the KDE/OpenSync meeting in Berlin next weekend. I’m really exited to see what we can get out of that. Now KPilot is getting into shape and the amount of types of devices on my desk is growing I’m really looking forward to have a desktop which is prepared to sync all me personal stuff between those gadgets and my normal pc. I have a growing conviction that a desktop should be just able to sync when I pop in one of my devices. So lets see what can be done to make this happen.

note to self: I should start reading the OpenSync and KitchenSync code. Continue reading

Posted in coding | Tagged , , | 2 Comments

The future of KPilot

Now the Google Summer of Code approaches its end I’d like to share some thoughts on KPilot. First of these is that I was slightly surprised by the responses I got on an earlier blog. I know that there are still KPilot users but in some sense I did not really believe it. So if you are a user and want to use it in KDE4 please let us know. It is really encouraging when getting some nice message from someone out there . I know, we are not so good in keeping our website up to date, so you might also want to drop by in #kpilot on irc.freenode.org or at our personal websites. Furthermore, you can follow development activities at the KPilot ohloh site.

That said, what are the plans for KPilot? Our major goal is to release a new KPilot version with KDE 4.2. So that will be in six months or so. In the past couple of months we have done a lot of work to get KPilot syncing with akonadi and the results are promising. At the end of this GSoC (that is, after two weeks from now) we have “working” todo, contacts and calendar conduits. Working is quoted as polishing of the KPilot code as well as some kdepim/akonadi code is needed. How usefull KPilot will be at release time also depends a bit on the other kdepim applications as none of them (except mailody?) are ported to Akonadi yet if I’m correct. However at 4.2 that has changed (we hope) and therefore the following conduits will be released then:

  • calendar
  • contacts
  • file installer
  • memofile
  • time
  • todos

The results of this GSoC and the previous one is that most conduits share way more code than they did before. This should make the maintenance and bugfixing a bit easier for us.

We also slimmed down our focus. KPilot will be the application to synchronize your KDE PIM data with your palm device. This means that we will remove the old database viewers that where in it in the 3.5 series. The viewer code is old, not good working, does not have any real purpose and we do not have time/energy to work on that. In return of that you will get category synchronization for each record based conduit. I have been thinking a bit about the gui of KPilot but have no clear idea yet how it should look. So good ideas on this are welcome.

Besides the “getting things working again” again, the codebase needs a lot of clean up. But first things first. All in all, this should make KPilot should survive another KDE series. Continue reading

Posted in coding | Tagged , , | 17 Comments