Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class Test : MonoBehaviour {
- // Use this for initialization
- void Start() {
- StartCoroutine(RunTest());
- }
- private IEnumerator RunTest() {
- yield return new WaitForSeconds(0.5f);
- var size = 10000;
- var stopwatch = new System.Diagnostics.Stopwatch();
- var a = new int[size, size];
- var b = new int[size][];
- for(int i = 0; i < size; i++) {
- b[i] = new int[size];
- }
- stopwatch.Start();
- for(int i = 0; i < size; i++) {
- for(int j = 0; j < size; j++) {
- b[i][j] = 5;
- }
- }
- stopwatch.Stop();
- Debug.Log(stopwatch.ElapsedMilliseconds);
- stopwatch.Reset();
- stopwatch.Start();
- for(int i = 0; i < size; i++) {
- for(int j = 0; j < size; j++) {
- a[i, j] = 5;
- }
- }
- stopwatch.Stop();
- Debug.Log(stopwatch.ElapsedMilliseconds);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment