Translate Runner

Matej Svejda matej.svejda at gmail.com
Sun Mar 16 00:53:31 CET 2008


> whoops! =)
My bad... ;-D No it works. I also added setSubtext and uploaded the
changes. Could you maybe add the runner to playground?

> one bit of feedback i have is that runners are meant to run in a separate
> thread, so i don't know if there's any real win to putting Translator in its
> own thread other than to increase the number of threads being used =)
Well the problem is that this runner uses QHttp which works
asynchronously. Putting this into a separate thread with it's own
event-loop and waiting in match() for this thread to finish seemed to
me like the only possible choice. Or is there some other way?

About smarter strategies for calling match():
This is one area where KRunner could definitely improve. Lot's of
resource-wasting here. As far as I understand it (from looking at the
code) the way KRunner handles queries is that after a certain time for
each known runner a new instance of that runner is created and the
match function for that runner is executed in a ThreadWeaver-job (is
that right?). So it can happen that if the user types at a decent
speed instances of slow runners pile up. I think you wrote about that
in one of your blog-entries...?
What I think could work better is to have only one instance per runner
and a stack of queries (also one for each runner). So each time a
runner finishes a match for one query it looks at the stack. If it's
not empty it takes the query at the top, clears the stack and calls
match for that query, otherwise it does nothing. That way we can avoid
runners building up (which might not be an issue now but might become
if we have more runners) and also give slow runners enough time to at
least display something while the user is still typing, not just when
he's done. Also KRunner won't have to worry about whether a runner is
fast or slow.

>this itself probably requires pulling out this sort of code from
>krunner/interface.cpp to a match manager class, which is already one of the
> SoC proposals.
Do you have any details on that? My proposal kind of overlaps with that...


More information about the Panel-devel mailing list