[PATCH] KIO::SlaveBase and the event loop

Ingo Klöcker kloecker at kde.org
Wed Jul 16 21:27:55 BST 2008


On Wednesday 16 July 2008, Roland Harnau wrote:
> 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 {
>     Q_OBJECT
> public slots:
>     void run() {
>         QTime time;
>         time.start();
>         for (int i = 0; i < 20; ++i) {
>             int error;
>             QString errorString;
>             KIO::Slave::createSlave("http",
> KUrl("http://www.kde.org"), error, errorString);
>         }
>         std::cout << "Elapsed time (msec): " << time.elapsed() <<
> std::endl; KApplication::exit();
>     }
> };
>
> 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.

The above "proof" is totally irrelevant as well. When I asked for actual 
numbers then I expected actual numbers measured by profiling actual 
applications (you mentioned Konqueror) e.g. via valgrind/callgrind. 
Unless you can proof that starting lots of IO slaves in Konqueror is a 
real problem your concerns are insubstantial.

Of course, nobody stops you from writing a proof-of-concept which 
demonstrates that through the use of threads instead of separate 
processes Konqueror gets twice as fast.


Regards,
Ingo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 194 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20080716/6a511b58/attachment.sig>


More information about the kde-core-devel mailing list