Skip to content

Instantly share code, notes, and snippets.

@baba-s
Created January 17, 2016 10:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baba-s/53e486f3832268f56953 to your computer and use it in GitHub Desktop.
Save baba-s/53e486f3832268f56953 to your computer and use it in GitHub Desktop.
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