On Thu, Aug 23, 2012 at 10:50 AM, Carsten Haitzler <ras...@rasterman.com>wrote:
> On Thu, 23 Aug 2012 14:46:43 +0100 Michael Blumenkrantz > <michael.blumenkra...@gmail.com> said: > > > fair enough, but it still seems like it should be stringshared so that > you > > can avoid strcmps > > thats if the strcmp mattered in terms of perf :) > and depends on the number of usage, both of the comparisons and the stringshare lifetime. When you "stringshare add", it will walk the string twice (strlen, hash), then access the hash bucket, then walk red-black tree doing full hash comparison and strcmp (AFAIR). Then the pointer comparison is constant size (number of bytes in pointer). That means if you keep the stringshare around and does lots of comparions with it, it will save you time. But the following pattern may result in slower code if the comparison list is small: s = stringshare-add(s) foreach (c in comparison-list) if (s == c) return true return false If the comparison list is big enough, then it will always be worth. -- Gustavo Sverzut Barbieri http://profusion.mobi embedded systems -------------------------------------- MSN: barbi...@gmail.com Skype: gsbarbieri Mobile: +55 (19) 9225-2202 ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel