Use a key-based lookup to find an emoticon
When Spark tries to display an emoticon, it iterates over all emoticons until it finds the correct one. That's easily improved upon by using a dictionary-based lookup.
Another thing to keep in mind if going the packs updating route. Spark may not the updating emoticons packs upon update (this might not be the case with the installer doing uninstall, but not sure).
It looks like Spark can't parse keys with only capital letters in equivalents now. If i add ": d" and ":- d" to its equivalents, grin icon starts to work. I can change all the packs by adding these strings (though grin icon usually is presented with capital D only), but maybe there is an easier programmatic fix. Before that change it was doing
Which was converting ": d" to grin icon as well, so maybe changing the packs would have the same result.
For some reason ": D" (without space) and ":- D" stopped working in Spark (not replacing with emoticon). Will look into this myself.