Здравствуйте, ins-omnia, Вы писали:
IO>Тут должна быть ссылка на сравнение производительности C# и Java для "обработки большех объёмов данных" на каком-нибудь иллюстративном примере.
public class V3 {
public float X;
public float Y;
public float Z;
public V3(float x, float y, float z) {
X = x; Y = y; Z = z;
}
}
public class Test {
public static void main(String[] args) {
Random rand = new Random(0);
long s = System.nanoTime();
V3[] mesh = new V3[1 << 24];
for (int i = 0; i != mesh.length; ++i)
mesh[i] = MakeRandVector(rand);
V3 dir = MakeRandVector(rand);
double sum = 0.0;
for (int i = 0; i != mesh.length; ++i)
sum += mesh[i].X * dir.X + mesh[i].Y * dir.Y + mesh[i].Z * dir.Z;
long f = System.nanoTime();
long milliseconds = (f - s) / 1000000;
System.out.println(milliseconds + " : " + sum);
}
private static V3 MakeRandVector(Random rand) {
return new V3(rand.nextFloat(), rand.nextFloat(), rand.nextFloat());
}
}
[ Record ]
public struct V3
{
public X : float;
public Y : float;
public Z : float;
}
def rand = JavaRandom(0);
def MakeRandVector()
{
V3(rand.NextFloat(), rand.NextFloat(), rand.NextFloat())
}
def stopwatch = Stopwatch.StartNew();
def mesh = array(1 << 24);
for (mutable i = 0; i != mesh.Length; ++i)
mesh[i] = MakeRandVector();
def dir = MakeRandVector();
mutable sum = 0.0;
for (mutable i = 0; i != mesh.Length; ++i)
sum += mesh[i].X * dir.X + mesh[i].Y * dir.Y + mesh[i].Z * dir.Z;
stopwatch.Stop();
Console.WriteLine("{0} : {1}", stopwatch.ElapsedMilliseconds, sum);