{"id":8652,"date":"2014-04-02T08:37:54","date_gmt":"2014-04-02T12:37:54","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=8652"},"modified":"2014-04-02T08:37:54","modified_gmt":"2014-04-02T12:37:54","slug":"surveying-various-languages-string-search-algorithms","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2014\/04\/02\/surveying-various-languages-string-search-algorithms\/","title":{"rendered":"Surveying Various Languages&rsquo; String-search Algorithms"},"content":{"rendered":"<p><a href=\"http:\/\/nelhagedebugsshit.tumblr.com\/post\/81301884746\/surveying-various-languages-string-search-algorithms\">Nelson Elhage<\/a>:<\/p>\n<blockquote cite=\"http:\/\/nelhagedebugsshit.tumblr.com\/post\/81301884746\/surveying-various-languages-string-search-algorithms\"><p>It turns out that virtually every other language [than Java] I know of uses an optimized string-search by default, which had the upshot that simply rewriting our Scala code in Ruby(!) would actually make the code dramatically faster and pass our benchmarks! &ldquo;Oops&rdquo;.<\/p>\n<p>But inspired by this, I decided to go do a brief survey of common language\/VM string-search algorithms[&#8230;]<\/p><\/blockquote>\n<p>It looks like <a href=\"http:\/\/www.opensource.apple.com\/source\/CF\/CF-855.11\/CFString.c\">CFStringFindWithOptionsAndLocale()<\/a> uses a Java-style slow matching algorithm rather than something like <a href=\"http:\/\/en.wikipedia.org\/wiki\/Boyer&#8211;Moore_string_search_algorithm\">Boyer-Moore<\/a>.<\/p>","protected":false},"excerpt":{"rendered":"<p>Nelson Elhage: It turns out that virtually every other language [than Java] I know of uses an optimized string-search by default, which had the upshot that simply rewriting our Scala code in Ruby(!) would actually make the code dramatically faster and pass our benchmarks! &ldquo;Oops&rdquo;. But inspired by this, I decided to go do a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"","apple_news_api_id":"","apple_news_api_modified_at":"","apple_news_api_revision":"","apple_news_api_share_url":"","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[289,45,69,846,84,346,138,71,232,287],"class_list":["post-8652","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-algorithm","tag-c","tag-cocoa","tag-go-language","tag-java","tag-javascript","tag-optimization","tag-programming","tag-python","tag-ruby"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/8652","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=8652"}],"version-history":[{"count":0,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/8652\/revisions"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=8652"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=8652"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=8652"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}