------------------------------------------------------------ revno: 345 committer: Michal Hruby <michal....@gmail.com> branch nick: bluebird timestamp: Sun 2011-12-11 20:44:41 +0100 message: Use statically allocated StringChunk to store the manifestations/interpretations/mimetypes/actors modified: src/datamodel.vala
-- lp:zeitgeist https://code.launchpad.net/~zeitgeist/zeitgeist/bluebird Your team Zeitgeist Framework Team is subscribed to branch lp:zeitgeist. To unsubscribe from this branch go to https://code.launchpad.net/~zeitgeist/zeitgeist/bluebird/+edit-subscription
=== modified file 'src/datamodel.vala' --- src/datamodel.vala 2011-10-17 07:46:27 +0000 +++ src/datamodel.vala 2011-12-11 19:44:41 +0000 @@ -285,16 +285,40 @@ public class Event : Object { + private static StringChunk url_store; + public uint32 id { get; set; } public int64 timestamp { get; set; } - public string interpretation { get; set; } - public string manifestation { get; set; } - public string actor { get; set; } public string origin { get; set; } + public string actor + { + get { return _actor; } + set { _actor = url_store.insert_const (value); } + } + public string interpretation + { + get { return _interpretation; } + set { _interpretation = url_store.insert_const (value); } + } + public string manifestation + { + get { return _manifestation; } + set { _manifestation = url_store.insert_const (value); } + } + + private unowned string _actor; + private unowned string _interpretation; + private unowned string _manifestation; + public GenericArray<Subject> subjects { get; set; } public ByteArray? payload { get; set; } + static construct + { + url_store = new StringChunk (4096); + } + construct { subjects = new GenericArray<Subject> (); @@ -514,16 +538,41 @@ public class Subject : Object { + private static StringChunk url_store; public string uri { get; set; } - public string interpretation { get; set; } - public string manifestation { get; set; } - public string mimetype { get; set; } public string origin { get; set; } public string text { get; set; } public string storage { get; set; } + // FIXME: current_uri is often the same as uri, we don't need to waste + // memory for it public string current_uri { get; set; } + public string mimetype + { + get { return _mimetype; } + set { _mimetype = url_store.insert_const (value); } + } + public string interpretation + { + get { return _interpretation; } + set { _interpretation = url_store.insert_const (value); } + } + public string manifestation + { + get { return _manifestation; } + set { _manifestation = url_store.insert_const (value); } + } + + private unowned string _mimetype; + private unowned string _interpretation; + private unowned string _manifestation; + + static construct + { + url_store = new StringChunk (4096); + } + public Subject.from_variant (Variant subject_variant) { VariantIter iter = subject_variant.iterator();
_______________________________________________ Mailing list: https://launchpad.net/~zeitgeist Post to : zeitgeist@lists.launchpad.net Unsubscribe : https://launchpad.net/~zeitgeist More help : https://help.launchpad.net/ListHelp