[PATCH] KIO::SlaveBase and the event loop

Roland Harnau truthandprogress at googlemail.com
Wed Jul 16 14:00:53 BST 2008

2008/7/16, Ingo Klöcker <kloecker at kde.org>:
> On Tuesday 15 July 2008, Roland Harnau wrote:

>> Apropos ambitious plans: In the planning phase for KDE4 did you
>> consider to re-implement the IO slaves as threads? The process
>> creation cost including the D-Bus talk to klauncher seem quite high
>> to me, especially if Konqueror launches 20 or more  of them.
> Do you have actual numbers proving that this is a problem?

That's easy. Take a look at  the following code snippet:

class Runner : public QObject {
public slots:
    void run() {
        QTime time;
        for (int i = 0; i < 20; ++i) {
            int error;
            QString errorString;
KUrl("http://www.kde.org"), error, errorString);
        std::cout << "Elapsed time (msec): " << time.elapsed() << std::endl;

The (reproducible) output for a call to Runner::run is
Elapsed time (msec): 2605

The code is compiled with CMAKE_BUILD_TYPE=Release and runs on my high
speed eeePC.

> I suggest to read D. J. Bernstein's very interesting paper "Some
> thoughts on security after ten years of qmail 1.0" ([1]), in
> particular, section 2.6.
> [1] http://cr.yp.to/qmail/qmailsec-20071101.pdf

Pretty irrelevant. Knuth's remark regarding "premature optimization"
gets really overused.


More information about the kde-core-devel mailing list