84 lines
1.7 KiB
C#
84 lines
1.7 KiB
C#
using StgSharp.Math;
|
|
using System;
|
|
using System.Diagnostics;
|
|
|
|
namespace StgSharp
|
|
{
|
|
|
|
internal static class Program
|
|
{
|
|
internal unsafe static void Main(string[] args)
|
|
{
|
|
Matrix4x4 m = new Matrix4x4(
|
|
0,1,2,3,
|
|
4,5,6,7,
|
|
0,1,2,3,
|
|
4,5,6,7
|
|
);
|
|
for (int i = 0; i < 1000; i++)
|
|
{
|
|
Matrix4x4 ret = m;
|
|
}
|
|
//Console.WriteLine(m + m);
|
|
|
|
/*
|
|
System.Numerics.Matrix4x4 smt1 = new System.Numerics.Matrix4x4(
|
|
1,2,3,4,
|
|
5,6,7,8,
|
|
1,2,3,4,
|
|
5,6,7,8
|
|
);
|
|
|
|
Matrix4x4 gmt1 = new Matrix4x4(
|
|
1, 2, 3, 4,
|
|
5, 6, 7, 8,
|
|
1, 2, 3, 4,
|
|
5, 6, 7, 8
|
|
);
|
|
|
|
Stopwatch s = new Stopwatch();
|
|
|
|
double cycle = 1e6;
|
|
|
|
for (int t = 0; t < 1000; t++)
|
|
{
|
|
s.Reset();
|
|
s.Start();
|
|
for (int i = 0; i < cycle; i++)
|
|
{
|
|
System.Numerics.Matrix4x4 ret = smt1* smt1;
|
|
}
|
|
s.Stop();
|
|
|
|
TimeSpan span = s.Elapsed;
|
|
Console.WriteLine(span.TotalMilliseconds);
|
|
|
|
s.Reset();
|
|
s.Start();
|
|
|
|
for (int i = 0; i < cycle; i++)
|
|
{
|
|
Matrix4x4 ret = VectorCalc.Multiple(gmt1,gmt1);
|
|
}
|
|
s.Stop();
|
|
|
|
TimeSpan span1 = s.Elapsed;
|
|
Console.WriteLine(span1.TotalMilliseconds);
|
|
|
|
Console.WriteLine();
|
|
|
|
|
|
}
|
|
|
|
/**/
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|