4 ms·
string.indexOf() is O(n), whereas the object-property-lookup is O(1). I guess indexOf is fast enough anyway given the size of the dictionary.
by johnitsagal 16y ago
string.indexOf() is O(n), whereas the object-property-lookup is O(1). I guess indexOf is fast enough anyway given the size of the dictionary.
- statictype 16y agoIs this a bug in HN? I guess this was meant to be posted to the dictionary/javascript topic?
- johnitsagal 16y agoMore likely my mistake; yes it was intended for http://news.ycombinator.com/item?id=2329940 http://news.ycombinator.com/item?id=2329940 . Why are people upvoting my comment?!
- jeromec 16y agoApparently discussing code on Hacker News is never off-topic ;)
- jedsmith 16y agoI upvoted it because I was looking for the underlying meaning of an elegant comment. Surely it means something, I said...
- jacoblyles 16y agoIt's nice to see some hard tech content every now and then, even if non-sequitir.