{"id":1583,"date":"2012-03-13T03:48:06","date_gmt":"2012-03-13T03:48:06","guid":{"rendered":"http:\/\/glaringnotebook.com\/?p=1583"},"modified":"2012-03-13T03:48:06","modified_gmt":"2012-03-13T03:48:06","slug":"stringing-along","status":"publish","type":"post","link":"https:\/\/glaringnotebook.com\/?p=1583","title":{"rendered":"Stringing Along"},"content":{"rendered":"<p>How much slower is a Java <b>String<\/b> object comparison, compared to a primitive <b>int<\/b> comparison? I was curious, so I made a little Android app to compare an array of integers and Strings 10 million times each.<\/p>\n<pre>package test.benchstring;<\/p>\n<p>import java.util.Random;<\/p>\n<p>import android.app.Activity;<br \/>\nimport android.os.Bundle;<br \/>\nimport android.util.Log;<\/p>\n<p>public class BenchStringActivity extends Activity {<br \/>\n\tint MAX = 10000000;<br \/>\n\tint[] arrayInt = {0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How much slower is a Java String object comparison, compared to a primitive int comparison? I was curious, so I made a little Android app to compare an array of integers and Strings 10 million times each. package test.benchstring; import java.util.Random; import android.app.Activity; import android.os.Bundle; import android.util.Log; public class BenchStringActivity extends Activity { int MAX [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[],"class_list":["post-1583","post","type-post","status-publish","format-standard","hentry","category-geek"],"_links":{"self":[{"href":"https:\/\/glaringnotebook.com\/index.php?rest_route=\/wp\/v2\/posts\/1583","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/glaringnotebook.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/glaringnotebook.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/glaringnotebook.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/glaringnotebook.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1583"}],"version-history":[{"count":0,"href":"https:\/\/glaringnotebook.com\/index.php?rest_route=\/wp\/v2\/posts\/1583\/revisions"}],"wp:attachment":[{"href":"https:\/\/glaringnotebook.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1583"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/glaringnotebook.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1583"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/glaringnotebook.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1583"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}