Use of GObject properties in DMAPRecord is too slow
Submitted by Alexandre Rosenfeld
Link to original bug (#625215)
Description
Several reports exist that shows that using GObject properties are too slow, such as:
https://bugzilla.gnome.org/show_bug.cgi?id=536939 http://zee-nix.blogspot.com/2008/09/think-before-you-create-gobjects.html
In libdmapsharing, GObject properties are used in DMAPRecord to store metadata information on records and this metadata is used to filter records based on query criteries. This means thousands of properties are accessed in every query (this depends on the number of records in the database, usually hundreds or thousands and the number of properties on the query, usually 2 or 3). To make matters worse, in libdmapsharing's biggest consumer, Rhythmbox, a DMAPRecord object is created for each record in Rhythmbox's database in every query and destroyed just after it's used, which also means a lot of data is copied into DMAPRecord properties, which might not even be used.
A possible solution is to create another method in DMAPRecord, such as:
(void *) get_metadata (gchar *name, GValue *value);
Or better yet, change name into an Enum.
And also change Rhythmbox into looking up the metadata directly in it's entry, avoiding unnecessarily copying properties.
Version: git master