private void TestByte()
    {
        Debug.Log("  Testing ObscuredByte vs byte preformance:\n  " + byteIterations + " iterations for read and same for write");

        Stopwatch sw = Stopwatch.StartNew();

        ObscuredByte obscured    = 100;
        byte         notObscured = obscured;
        byte         dummy       = 0;

        for (int i = 0; i < byteIterations; i++)
        {
            dummy = obscured;
        }

        for (int i = 0; i < byteIterations; i++)
        {
            obscured = dummy;
        }

        Debug.Log("    ObscuredByte:\n    " + sw.ElapsedMilliseconds + " ms ");
        sw.Reset();

        sw.Start();
        for (int i = 0; i < byteIterations; i++)
        {
            dummy = notObscured;
        }

        for (int i = 0; i < byteIterations; i++)
        {
            notObscured = dummy;
        }

        sw.Stop();
        Debug.Log("    byte:\n    " + sw.ElapsedMilliseconds + "  ms ");

        if (dummy != 0)
        {
        }
        if (obscured != 0)
        {
        }
        if (notObscured != 0)
        {
        }
    }
Ejemplo n.º 2
0
        private void TestByte()
        {
            logBuilder.AppendLine("ObscuredByte vs byte, " + byteIterations + " iterations for read and write");

            ObscuredByte obscured    = 100;
            byte         notObscured = obscured;
            byte         dummy       = 0;

            var sw = Stopwatch.StartNew();

            for (var i = 0; i < byteIterations; i++)
            {
                dummy = obscured;
            }

            for (var i = 0; i < byteIterations; i++)
            {
                obscured = dummy;
            }
            sw.Stop();
            logBuilder.AppendLine("ObscuredByte:").AppendLine(sw.ElapsedMilliseconds + " ms");

            sw.Reset();
            sw.Start();
            for (var i = 0; i < byteIterations; i++)
            {
                dummy = notObscured;
            }

            for (var i = 0; i < byteIterations; i++)
            {
                notObscured = dummy;
            }

            sw.Stop();
            logBuilder.AppendLine("byte:").AppendLine(sw.ElapsedMilliseconds + " ms");

            if (dummy != 0)
            {
            }
            if (obscured != 0)
            {
            }
            if (notObscured != 0)
            {
            }
        }
Ejemplo n.º 3
0
        private void TestByte()
        {
            this.logBuilder.AppendLine("ObscuredByte vs byte, " + this.byteIterations + " iterations for read and write");
            ObscuredByte value     = 100;
            byte         b         = value;
            byte         b2        = 0;
            Stopwatch    stopwatch = Stopwatch.StartNew();

            for (int i = 0; i < this.byteIterations; i++)
            {
                b2 = value;
            }
            for (int j = 0; j < this.byteIterations; j++)
            {
                value = b2;
            }
            stopwatch.Stop();
            this.logBuilder.AppendLine("ObscuredByte:").AppendLine(stopwatch.ElapsedMilliseconds + " ms");
            stopwatch.Reset();
            stopwatch.Start();
            for (int k = 0; k < this.byteIterations; k++)
            {
                b2 = b;
            }
            for (int l = 0; l < this.byteIterations; l++)
            {
                b = b2;
            }
            stopwatch.Stop();
            this.logBuilder.AppendLine("byte:").AppendLine(stopwatch.ElapsedMilliseconds + " ms");
            if (b2 != 0)
            {
            }
            if (value != 0)
            {
            }
            if (b != 0)
            {
            }
        }
    private void TestByte()
    {
        UnityEngine.Debug.Log("  Testing ObscuredByte vs byte preformance:\n  " + byteIterations + " iterations for read and same for write");
        Stopwatch    stopwatch = Stopwatch.StartNew();
        ObscuredByte value     = (byte)100;
        byte         b         = value;
        byte         b2        = 0;

        for (int i = 0; i < byteIterations; i++)
        {
            b2 = value;
        }
        for (int j = 0; j < byteIterations; j++)
        {
            value = b2;
        }
        UnityEngine.Debug.Log("    ObscuredByte:\n    " + stopwatch.ElapsedMilliseconds + " ms ");
        stopwatch.Reset();
        stopwatch.Start();
        for (int k = 0; k < byteIterations; k++)
        {
            b2 = b;
        }
        for (int l = 0; l < byteIterations; l++)
        {
            b = b2;
        }
        stopwatch.Stop();
        UnityEngine.Debug.Log("    byte:\n    " + stopwatch.ElapsedMilliseconds + "  ms ");
        if (b2 != 0)
        {
        }
        if ((byte)value != 0)
        {
        }
        if (b == 0)
        {
        }
    }
Ejemplo n.º 5
0
 public OByte(byte value)
 {
     this.value = (ObscuredByte)value;
 }