Andrei's suggestion seems efficient, because we calculate md5 for every new bookmark and after that we have to compare 16-byte length strings in the whole database.<br>Jon's approach is fine too, because it's rare to have many favicons for one domain, and it will be found after few comparisons without extra overhead of calculating md5 sums. but before comparison, we should lookup domain name in the whole database.<br>

<br>Which one is more efficient in your opinion?<br><br><div class="gmail_quote">On Tue, Aug 30, 2011 at 6:21 PM, Andrei Nistor <span dir="ltr"><<a href="mailto:coder.tux@ceata.org">coder.tux@ceata.org</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">On Tue, 30 Aug 2011 13:52:27 +0100, Jon Spriggs wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
How about this for a favicon workflow?<br>
<br>
1) Download favicon. It's the first time it's been used, store it as<br>
www.example.com.0.ico and add that favicon to the database.<br>
2) Second person adds a bookmark in <a href="http://www.example.com" target="_blank">www.example.com</a>. Download the<br>
favicon, and then diff it against each of the dns-named favicons which<br>
have been downloaded - currently only www.example.0.ico - if it's the<br>
same, delete the downloaded favicon and re-use www.example.com.0.ico<br>
in the database. If it's not the same store it as<br>
www.example.com.1.ico.<br>
3) User deletes their bookmark which is the last instance of<br>
www.example.com.0.ico. System deletes www.example.com.0.ico from the<br>
system.<br>
<br>
</blockquote>
<br></div>
I'd like to propose an alternative:<br>
<br>
Download favicon, compute it's hash (using MD5/SHA1/whatever). Look up the hash in the database, if it doesn't exist, insert it, if it exists, use it.<br>
<br>
P.S. sorry for the double reply, missed the CC list on first try.<br>
-- <br>
Andrei<br>
</blockquote></div><br>