Re: An article on tinymail?



Hi Sri,

On Wed, 02 Aug 2006, ext Sriram Ramkrishna wrote:

> Anytime friday I think.  I'll let people know to expect one from you.
> Thanks so much for writing!!
 
Here it is. If you have any questions, pls try djcb djcbsoftware nl or
IM: djcb jabber org, as I probably won't read my Nokia e-mail.

Best wishes,
Dirk.

Tinymail - evolution and intelligent design

[1] Philip, talking at GUADEC
For some years now, Evolution has been the default e-mail program for the GNOME-desktop. It uses a flexible architecture and provides mature implementations of many e-mail protocols (POP3, IMAPv4, SMTP, and even Exchange, Groupwise and Hula). Also, it has an advanced UI, which is getting even more friendly in the next release - as seen at GUADEC.

Great. However, all this requires quite a bit of memory. Tens of megabytes for moderate amounts of e-mail. Now, there's a lot of memory in your desktop PC, but what about an 'embedded' device? For example, the Nokia 770 Internet Tablet. Or the One-Laptop-per-Child (OLPC) machine? In such devices, we need to be very careful with the memory usage. Also, they usually require user-interfaces which are very different from the one Evolution offers - if only for the much smaller screen sizes. So, what if we took the mature, non-UI parts of Evolution, cut down on the memory usage, and made it possible to have customized user-interfaces? Wouldn't that be great for embedded devices, and even for low-end PCs?

That is exactly what Philip van Hoof did.

philip

Philip van Hoof (1981) is an energetic software developer from the village of Oud-Turnhout in Belgium. He has strong opinions about software, and no qualms about voicing those (which sometimes causes some friction...) Philip works as a (surprise) software developer. After work, he likes to do even more (Free) software development, and he worked on many projects inside and outside GNOME.

Recently, Philip has been looking into the area of e-mail libraries. He wanted to explore ways of using the e-mail protocol parts of Evolution in a more memory-efficient way. He named the resulting framework after his girlfriend, Tinne. Thus, Tinymail (pronounced Tinniemail) was born. It's an abstraction layer on top of libcamel (the library on which Evolution is built).

memory savings

[2] the Tinymail test UI. running on the Nokia 770
Tinymail offers very substantial memory savings, compared to Evolution - 80% or more, in some tests. Tinymail achieves this by being very aggressive with it's memory management, and only keeping in memory what is really needed at that time. For example, Evolution keeps the header data for all mailfolders in memory. This is required to support virtual folders (saved searches that look like normal folders). As Tinymail does not support virtual folders, it only needs to keep the currently selected folder in memory. And that saves a lot of memory.

But Tinymail goes one step further. If you are browsing through your mail headers, you don't need to have all of them in memory. You only need the ones that you can currently see. Tinymail does some clever tricks with the way it lists messages (using the so-called Proxy design pattern), so that it only allocates memory for the ones that you can actually see; the memory for all the other ones is reduced to the very minimum. While this sounds a bit slower than keeping everything in memory, in practice it does not seem a problem. Even on devices like the Nokia 770, you can smoothly scroll through thousands of messages. A reason for this might be that the less memory use in itself gives performance benefits, due to better cache usage.

interfaces

Tinymail uses concepts from 'interface-based programming' to present the client programmer with a relatively clean way to program e-mail applications. In fact, even libcamel itself is abstracted away in these interfaces, and Tinymail could use an alternative library instead. Tinymail makes heavy use of the object-orientation (OO) features of the GObject-system. The APIs are just interfaces, with many possible implementations. Tinymail typically supplies one particular implementation, but you could simply plug in your own.

For example, Tinymail has an interface for displaying e-mails (TnyMsgIface). It also supplies different implementations for this interface - GtkTextView and Mozilla. You can have your e-mail program display messages in either of those, whatever is the best for the specific situation. But you might still want something else. For example, others have written a GtkHTML-implementation. Tinymail does not even have to know it exists. It will use whatever the client programmer specifies, as long as it conforms to the TnyMsgIface-interface.

As another example, Tinymail provides the TnyDeviceIface, which is in abstraction of the network connection of a system. If your e-mail program needs to get online, you can 'ask' through this interface. And it does not matter wat the actual implementation looks like. Tinymail comes with a TnyDeviceIface for the NetworkManager in GNOME. Other people are working on implementations for other devices.

Such software-Lego sounds like some long-foregone dream from the mid-nineties. But in Tinymail it actually works quite nicely. Of course, there are limits to the syntactic sugaring that the C programming language can do for you. As with all GObject-based code, there is a lot of explicit up and downcasting of pointers involved. And a lot of boilerplate code. Furthermore, writing software with a framework requires a bit more of the programmer than using a simple library. Instead of just calling a bunch of library functions, the software enters into some symbiotic relationship with Tinymail, which requires you to do things in a certain way.

back to the future

[3] "modest", an (unreleased) e-mail program, based on Tinymail
There has been quite some interest in the Tinymail-project. For example, from the people in the GPE-project. And from Nokia, who did some experimental work with Tinymail already ("modest", picture [3]). Tinymail also runs smoothly on the Nokia 770, as shown in picture [2]). And there are the OLPC-people, who are evaluating various solutions. They will probably be interested in the Tinymail Python-bindings, which have recently become available.

So, if you are working on a new e-mail client (aren't we all), you should take a look at Tinymail. It does take some time to get familiar with it, especially if you are not fluent with GObject. Also, Tinymail has not seen an official release yet, and API changes are to be expected. Still, the framework is well designed, fairly complete, and is released under the LGPL license. Furthermore, it comes with a lot of documentation and unit-tests.

Even if you are not writing your own e-mail client, or are not a programmer at all, Tinymail can benefit you. The project has sparked a lot of new interest and improvements, which will benefit all Evolution-users. Philip has made additional impressive memory reductions to Evolution (not depending on Tinymail), using mmap. At the same time, Ross Burton saved more megabytes by killing of unnecessary copies of libraries. This will all result in a meaner and leaner Evolution - a nicer experience for all users. It's also shows how the work on GNOME for embedded devices ultimately benefits all GNOME-users.

This article only gave a short overview of Tinymail. If you want to find out more, you can visit the Tinymail website, join the mailing list,... Tinymail is still under heavy development, so this is the time where you can make a change!

Attachment: philipvh.jpeg
Description: JPEG image

Attachment: tinymail770.jpg
Description: JPEG image

Attachment: modest2.png
Description: PNG image



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]