← Back to team overview

unity-dev team mailing list archive

Re: Faster dash

 

On 05/26/2012 05:48 PM, Michal Hruby wrote:
On Sat 26 May 2012 05:06:08 AM CEST, Marco Trevisan (Treviño) wrote:
2012/5/26 Michal Hruby<michal.hruby@xxxxxxxxxxxxx>:
On Sat 26 May 2012 01:25:05 AM CEST, Michal Hruby wrote:
I implemented a custom GSource that allows adding of multiple timeouts
to this single source, I profiled this somewhat (against standard
timeout sources) and when using 8 different timeouts, the single custom
source requires 2.5x fewer lock calls (g_mutex_lock), ~6% fewer
instructions are executed and ~10% fewer branches.


Sorry, it's late :P here's a link to the custom source -
http://ubuntuone.com/2f9boSuvqS8zhgUcJqMry2

Cool, that's very similar to something I had in mind too...
We'd probably could include even the priority support (to be
glib-like) making timeouts that can happen "together" to be selected
also based on their priority...

However, for first version I think I'd just go with the "basic
wrapper", then I'd just could change it to use something like that.


The idea with this source was that you'd have one for different
priorities and there'd be a global map of priority ->  source. A quick
grep of unity sources showed that out of 74 timeout sources we're
using, only 2 use non-DEFAULT prio. (although 16/29 idle sources use
non-DEFAULT_IDLE prio).

Anyway ideally your wrapper should be able to handle standard sources
*as well as* something like this (where the timeout isn't really
GSource-based for the user).

Does it make sense to upstream these to glib? On the surface I can't see why g_idle_add*() and g_timeout_add*() couldn't use this approach by default.

Michal; if you have a good benchmark we could post the results on gtk-devel at least..?

Cheers,
Mikkel



References