Last active
July 15, 2016 15:01
-
-
Save sukedon/5d2e6ed7ab62b4ff51abcf2e229102a8 to your computer and use it in GitHub Desktop.
GameObjectの文字列プロパティパフォーマンスチェック用
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class StringPerformanceChecker : MonoBehaviour { | |
private GameObject sample; | |
private int examineCount = 10000; | |
private string targetTag = "Hoge"; | |
// Use this for initialization | |
IEnumerator Start () { | |
sample = new GameObject(); | |
yield return new WaitForSeconds(5f); | |
yield return ExamineTagCompareByPlane(); | |
yield return new WaitForSeconds(0.5f); | |
yield return ExamineTagCompareByMethod(); | |
} | |
IEnumerator ExamineTagCompareByPlane(){ | |
for(int i = 0;i < examineCount; i++){ | |
if(sample.tag == targetTag){ | |
//Do something | |
} | |
} | |
yield return null; | |
} | |
IEnumerator ExamineTagCompareByMethod(){ | |
for(int i = 0;i < examineCount; i++){ | |
if(sample.CompareTag(targetTag)){ | |
//Do something | |
} | |
} | |
yield return null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment