@@ -62,7 +62,6 @@ Tags Container allows you to group tags in a single asset, which allows you to c
62
62
``` csharp
63
63
using Sirenix .OdinInspector ;
64
64
using System .Diagnostics ;
65
- using ToolBox .Pools ;
66
65
using ToolBox .Tags ;
67
66
using UnityEngine ;
68
67
@@ -75,56 +74,36 @@ namespace ToolBox.Test
75
74
[SerializeField ] private string _unityTag = null ;
76
75
[SerializeField ] private GameObject _object = null ;
77
76
78
- [SerializeField , ReadOnly ] private float _myMS = 0 ;
79
- [SerializeField , ReadOnly ] private float _unityMS = 0 ;
80
-
81
- [SerializeField , ReadOnly ] private bool _hasMyTag = false ;
82
- [SerializeField , ReadOnly ] private bool _hasUnityTag = false ;
83
-
84
- private const int ITERATIONS = 10 ;
77
+ private const int ITERATIONS = 100000 ;
85
78
86
79
[Button ]
87
80
private void MyTagTest ()
88
81
{
89
- _myMS = 0 f ;
82
+ Stopwatch stopwatch = new Stopwatch ();
83
+ stopwatch .Start ();
90
84
91
- for (int i = 0 ; i < ITERATIONS ; i ++ )
85
+ for (int j = 0 ; j < ITERATIONS ; j ++ )
92
86
{
93
- Stopwatch stopwatch = new Stopwatch ();
94
- stopwatch .Start ();
95
-
96
- for (int j = 0 ; j < 100000 ; j ++ )
97
- {
98
- _hasMyTag = _object .HasTag (_myTag );
99
- }
100
-
101
- stopwatch .Stop ();
102
- _myMS += stopwatch .ElapsedMilliseconds ;
87
+ _object .HasTag (_myTag );
103
88
}
104
89
105
- _myMS /= ITERATIONS ;
90
+ stopwatch .Stop ();
91
+ UnityEngine .Debug .Log ($" Scriptable Object Tag Comparer: {stopwatch .ElapsedMilliseconds } milliseconds" );
106
92
}
107
93
108
94
[Button ]
109
95
private void UnityTagTest ()
110
96
{
111
- _unityMS = 0 ;
97
+ Stopwatch stopwatch = new Stopwatch ();
98
+ stopwatch .Start ();
112
99
113
- for (int i = 0 ; i < ITERATIONS ; i ++ )
100
+ for (int j = 0 ; j < ITERATIONS ; j ++ )
114
101
{
115
- Stopwatch stopwatch = new Stopwatch ();
116
- stopwatch .Start ();
117
-
118
- for (int j = 0 ; j < 100000 ; j ++ )
119
- {
120
- _hasUnityTag = _object .CompareTag (_unityTag );
121
- }
122
-
123
- stopwatch .Stop ();
124
- _unityMS += stopwatch .ElapsedMilliseconds ;
102
+ _object .CompareTag (_unityTag );
125
103
}
126
104
127
- _unityMS /= ITERATIONS ;
105
+ stopwatch .Stop ();
106
+ UnityEngine .Debug .Log ($" Unity Tag Comparer: {stopwatch .ElapsedMilliseconds } milliseconds" );
128
107
}
129
108
}
130
109
}
@@ -147,7 +126,7 @@ namespace ToolBox.Test
147
126
<details ><summary >Test Result</summary >
148
127
<p >
149
128
150
- ![ Result] ( https://imgur.com/YedN04E .png )
129
+ ![ Result] ( https://imgur.com/c8rnKdo .png )
151
130
152
131
</p >
153
132
</details >
0 commit comments