Optimising message header cache
Ross Burton
ross at burtonini.com
Wed Oct 26 12:55:45 PDT 2005
Hi,
In some profiling I found that DBus was spending most of it's time
running over iterators, and discovered the header location cache. As
the comments in _dbus_header_set_field_basic says the cache invalidation
is inefficient: every time a field is added the cache is invalidated and
has to be recreated from scratch. I had a think and implemented a new
cache invalidation function which only invalidates caches which point at
items beyond the item which was changed... but it doesn't work. Now, I
may be being stupid (quite likely) so I thought I'd post what I have and
let people wiser than me point out what I'm doing wrong.
_dbus_header_cache_invalidate_from() is just like invalidate_all but
compares the value_pos before wiping the entry.
Now in set_field_basic() if the field already existed then the cache is
invalidated from the location of the field. This is wasteful in the case
where the field didn't change size, but we can sort that out later.
This appears to work.
If the field didn't exist already then I'm a bit stuck. If I uncomment
the call to invalidate_all then the tests pass, but if I leave it
commented out and call invalidate_from(), even with 0, it fails to pass
make check:
dbus-test: running message tests
error: org.freedesktop.DBus.Error.InvalidArgs - Argument 0 is specified
to be of type "int16", but is actually of type "invalid"
Any idea why this is? I can't see there being any difference between
invalidate_all() and invalidate_from(, 0) so am stuck. Any ideas?
Ross
--
Ross Burton mail: ross at burtonini.com
jabber: ross at burtonini.com
www: http://www.burtonini.com./
PGP Fingerprint: 1A21 F5B0 D8D0 CFE3 81D4 E25A 2D09 E447 D0B4 33DF
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dbus-cache.diff
Type: text/x-patch
Size: 2434 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/dbus/attachments/20051026/c58f15ff/dbus-cache.bin
More information about the dbus
mailing list