ios - Is reading a bool faster than reading a string? -


i have basic array appended value depending on whether user hits 1 button or other. function called in viewdidload() method of app , perform function depending on value in array (it differ depending on index looking at, obviously, lets focus on first index). can either append array "yes"/"no", strings, or true/false, bools. since function relatively simple, recognize might not make huge deal, figured why not optimize whenever can. faster have if (or switch) statements check bool comparisons string comparisons? or other way around?

it better performance bool compares since compares 1 value (e.g 0 = 0 or 0 = 1), string has compare every character in string find match or no match.

tl:dr bool comparison faster string comparison


Comments

Popular posts from this blog

PHP and MySQL WP -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

go - golang pprof for c library code -