On Wed, Aug 14, 2013 at 1:06 PM, Richard Hughes <hughsi...@gmail.com> wrote: > On 14 August 2013 11:41, Kay Sievers <k...@vrfy.org> wrote: >> An example is here: >> >> http://cgit.freedesktop.org/systemd/systemd/tree/src/test/test-libudev.c#n432 > > Great! Thanks. So I know what to use where, what's the cost of those > functions?
It's all in a binary on-disk patricia trie, and all strings are de-duplicated. The lookup cost is almost "free", you should not notice it. > For instance, is udev_hwdb_new() going to use globs of > memory until udev_hwdb_unref() is called, The entire binary database file is mmap()ed into the address space as long as the context exists, no interesting amount of memory is allocated in the calling process or during lookup. > or are any of the functions > especially CPU intensive? The time is spends searching is mostly dependent on the length of the lookup string, and the amount of globs in the database that have common prefixes. None of that should really matter, you can ignore any such issues unless you plan to call it 1000s of time in an inner loop. > I can profile if required, although I'm > hoping the answer is "very little; very little" :) Unless something is wrong, it should be even less than little. :) Kay _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel