Created
January 17, 2016 10:33
-
-
Save baba-s/53e486f3832268f56953 to your computer and use it in GitHub Desktop.
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
using UnityEngine; | |
using System.Text; | |
public class ExampleClass : MonoBehaviour | |
{ | |
private string result; | |
private void OnGUI() | |
{ | |
if ( GUILayout.Button( "Start" ) ) | |
{ | |
var builder = new StringBuilder(); | |
builder.AppendLine( Test( 1000 ) ); | |
builder.AppendLine( Test( 10000 ) ); | |
builder.AppendLine( Test( 100000 ) ); | |
var str = builder.ToString(); | |
Debug.Log( str ); | |
result = str; | |
} | |
GUILayout.Label( result ); | |
} | |
private string Test( int count ) | |
{ | |
var builder = new StringBuilder(); | |
builder.AppendFormat( "■{0}件", count ).AppendLine(); | |
{ | |
var startTime = Time.realtimeSinceStartup; | |
for ( int i = 0; i < count; i++ ) | |
{ | |
Resources.Load<Texture>( "image" ); | |
} | |
var time = Time.realtimeSinceStartup - startTime; | |
builder.AppendFormat( "Resources.Load: {0}", time ).AppendLine(); | |
} | |
{ | |
var startTime = Time.realtimeSinceStartup; | |
Loader.Clear(); | |
for ( int i = 0; i < count; i++ ) | |
{ | |
Loader.Load( "image" ); | |
} | |
var time = Time.realtimeSinceStartup - startTime; | |
builder.AppendFormat( "Loader.Load: {0}", time ).AppendLine(); | |
} | |
return builder.ToString(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment