평가 보고서:.NET 의 성능 은 여전히 자바 보다 훨씬 뒤떨어진다.
모든 사람 이 다양한 벤 치 마크 를 보 았 는데.NET 이 자바 보다 빠르다 는 것 을 증명 하 는 것 도 있 고 자바 가.NET 보다 빠르다 는 것 을 증명 하 는 것 도 있다.누군가의 손 에 벤 치 마크 는 거울 로 보고 싶 은 것 을 볼 수 있다.그래서 이 Cameron 이라는 선생 이.NET 과 자바 사이 에 benchmark 를 만 들 기 시 작 했 을 때 그 는 자신 이 시간 을 낭비 하고 있다 고 생각 했다.왜냐하면 누군가가 자바 보다 빠르다 는 것 을 증명 할 것 이기 때문이다.
참고 로 Cameron 씨 는'.NET 과 자바 사이 에서 선택 하지 마 세 요'라 는 10 가지 이 유 를 제시 했다.그 중에서'o:p'Ø 특정한 벤 치 마크 중 하 나 는 다른 것 보다 빠 릅 니 다.
Ø Microsoft 나 Sun(또는 Oracle,IBM...)의 보고 서 는 그 중 하나 가 다른 것 보다 훨씬 좋다 고 말 합 니 다.
Ø 빌 게 이 츠 나 스 콧 맥 넬 리(또는 래 리 엘 리 슨);
Ø Microsoft 나 Sun(또는 IBM 또는 Oracle)이 사악 하 다 고 생각 합 니 다(또는 위대 하 다 고 생각 합 니 다).
Ø 당신 은 The ServerSide.com 이나 GotDotNet.com(또는 Microsoft.com)에서"편견 이 없다"는 글 을 읽 었 습 니 다.
실제로 이번 벤 치 마크 는 Cameron 과 tRolf 두 사람 이 The ServerSide.com 사이트 에서 웹 서비스 성능 에 대한 말다툼http://www.theserverside.com/reviews/thread.jsp?thread_id=19226에서 비롯 됐다.이번 벤 치 마크 에서 카메론 은 다음 버 전 을 테스트 했다.
.NET 1.0sp2:<o:p></o:p>
Microsoft (R) Visual C# .NET Compiler version 7.00.9466<o:p></o:p>
for Microsoft (R) .NET Framework version 1.0.3705<o:p></o:p>
Copyright (C) Microsoft Corporation 2001. All rights reserved.<o:p></o:p>
.NET 1.1:<o:p></o:p>
Microsoft (R) Visual C# .NET Compiler version 7.10.3052.4<o:p></o:p>
for Microsoft (R) .NET Framework version 1.1.4322<o:p></o:p>
Copyright (C) Microsoft Corporation 2001-2002. All rights reserved.<o:p></o:p>
Sun Hotspot Server JVM from JDK 1.3.1_04:<o:p></o:p>
java version "1.3.1_04"<o:p></o:p>
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_04-b02)<o:p></o:p>
Java HotSpot(TM) Server VM (build 1.3.1_04-b02, mixed mode)<o:p></o:p>
Sun Hotspot Server JVM from JDK 1.4.0_02:<o:p></o:p>
java version "1.4.0_02"<o:p></o:p>
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0_02-b02)<o:p></o:p>
Java HotSpot(TM) Server VM (build 1.4.0_02-b02, mixed mode)<o:p></o:p>
Sun Hotspot Server JVM from JDK 1.4.1_02:<o:p></o:p>
java version "1.4.1_02"<o:p></o:p>
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_02-b06)<o:p></o:p>
Java HotSpot(TM) Client VM (build 1.4.1_02-b06, mixed mode)<o:p></o:p>
코드 에 있어 서 Cameron 은 주로 대량의 Array List 를 선택 하여 테스트 를 진행 했다.다음은 그의 테스트 코드 입 니 다.C#
// C# Create 100,000 people in an ArrayList and access them
using System;
using System.Collections;
public class ManyPeople
{
public static void Main()
{
for (int i = 0; i < 100; i++)
test(i);
}
public static void test(int iIter)
{
DateTime start = DateTime.Now;
for (int i = 0; i < 20; i++)
new ManyPeople().Average();
DateTime finish = DateTime.Now;
Console.WriteLine("Total time for iteration " + iIter + ": " + (finish - start));
}
private long Average()
{
ArrayList list = new ArrayList(100000);
for (int i = 0; i < 100000; i++)
list.Add(new Person(i, "John " + i));
long silly = 0;
foreach (Person p in list)
silly += p.Id;
return silly / 100000;
}
}
// Person.cs: a very simple guy
public class Person
{
int id;
string name;
public Person(int anId, string aName)
{
this.id = anId;
this.name = aName;
}
public int Id
{
get { return this.id; }
}
}
Java:
// Java Create 100,000 people in an ArrayList and access them
import java.util.*;
public class ManyPeople
{
public static void main(String[] args)
{
for (int i = 0; i < 100; i++)
test(i);
}
public static void test(int iIter)
{
long start = System.currentTimeMillis();
for (int i = 0; i < 20; i++)
new ManyPeople().average();
long finish = System.currentTimeMillis();
System.out.println("Total time for iteration " + iIter + ": " + (finish - start));
}
private long average()
{
ArrayList list = new ArrayList(100000);
for (int i = 0; i < 100000; i++)
list.add(new Person(i, "John " + i));
long silly = 0;
for (int i = 0; i < 100000; i++)
silly += ((Person)list.get(i)).getId();
return silly;
}
}
// Person.java: a very simple guy
class Person
{
private int id;
private String name;
public Person(int anId, String aName)
{
this.id = anId;
this.name = aName;
}
public int getId()
{
return this.id;
}
}
Cameron 이 사용 하 는 테스트 기 기 는 P3 1GHz,1G 메모리 의 노트북 이 며,운영 체 제 는 Windows 2000 SP2 이다.다음은.NET 에서 테스트 한 결과(가장 좋 은 6 회 추출):
.NET 1.0sp2:
ManyPeople<o:p></o:p>
Total time for iteration 0: 00:00:07.3004976<o:p></o:p>
Total time for iteration 1: 00:00:07.0501376<o:p></o:p>
Total time for iteration 2: 00:00:07.2504256<o:p></o:p>
Total time for iteration 3: 00:00:07.7311168<o:p></o:p>
Total time for iteration 4: 00:00:07.5007856<o:p></o:p>
Total time for iteration 5: 00:00:07.5007856<o:p></o:p>
.NET 1.1:ManyPeople<o:p></o:p>
Total time for iteration 0: 00:00:08.0916352<o:p></o:p>
Total time for iteration 1: 00:00:08.5222544<o:p></o:p>
Total time for iteration 2: 00:00:08.3520096<o:p></o:p>
Total time for iteration 3: 00:00:08.6324128<o:p></o:p>
Total time for iteration 4: 00:00:08.3419952<o:p></o:p>
Total time for iteration 5: 00:00:08.1617360<o:p></o:p>
같은 코드 가.NET 1.1 에서.NET 1.0 SP2 보다 약 15%느 린 것 을 볼 수 있다.이것 은 매우 이상 한 현상 이다.또한,Cameron 은.NET 에서 같은 코드 의 운행 속도 가 운행 횟수 의 증가 에 따라 높 아 지지 않 는 다 는 것 을 관찰 하 였 으 며,이 는.NET CLR 이 JIT 컴 파일 만 간단하게 진행 되 었 다 는 것 을 의미한다.그리고 Hotspot Server 에 서 는 시작 할 때의 성능 이 우세 할 뿐만 아니 라 속도 도 계속 향상 된다.Sun Hotspot Server JVM from JDK 1.4.1_02:
java -server -Xms128m -Xmx128m ManyPeople<o:p></o:p>
Total time for iteration 0: 6370<o:p></o:p>
Total time for iteration 1: 5788<o:p></o:p>
Total time for iteration 2: 5868<o:p></o:p>
Total time for iteration 3: 6029<o:p></o:p>
Total time for iteration 4: 5748<o:p></o:p>
Total time for iteration 5: 5738<o:p></o:p>
Total time for iteration 6: 5729<o:p></o:p>
Total time for iteration 7: 5948<o:p></o:p>
Total time for iteration 8: 5688<o:p></o:p>
Total time for iteration 9: 5679<o:p></o:p>
Total time for iteration 10: 5658<o:p></o:p>
Total time for iteration 11: 6028<o:p></o:p>
Total time for iteration 12: 5699<o:p></o:p>
Total time for iteration 13: 5708<o:p></o:p>
Total time for iteration 14: 5678<o:p></o:p>
Total time for iteration 15: 5969<o:p></o:p>
Total time for iteration 16: 5628<o:p></o:p>
Total time for iteration 17: 5538<o:p></o:p>
Total time for iteration 18: 5608<o:p></o:p>
Total time for iteration 19: 5498<o:p></o:p>
Total time for iteration 20: 5768<o:p></o:p>
Total time for iteration 21: 5518<o:p></o:p>
Total time for iteration 22: 5307<o:p></o:p>
Total time for iteration 23: 4247<o:p></o:p>
Total time for iteration 24: 4696<o:p></o:p>
Total time for iteration 25: 4617<o:p></o:p>
Total time for iteration 26: 4777<o:p></o:p>
Total time for iteration 27: 4286<o:p></o:p>
Total time for iteration 28: 4677<o:p></o:p>
Total time for iteration 29: 4626<o:p></o:p>
Total time for iteration 30: 4697<o:p></o:p>
Total time for iteration 31: 4286<o:p></o:p>
Total time for iteration 32: 4697<o:p></o:p>
Total time for iteration 33: 4617<o:p></o:p>
Total time for iteration 34: 4696<o:p></o:p>
Total time for iteration 35: 4307<o:p></o:p>
Total time for iteration 36: 4686<o:p></o:p>
Total time for iteration 37: 4807<o:p></o:p>
Total time for iteration 38: 4517<o:p></o:p>
Total time for iteration 39: 4306<o:p></o:p>
Total time for iteration 40: 4657<o:p></o:p>
Total time for iteration 41: 4807<o:p></o:p>
Total time for iteration 42: 4596<o:p></o:p>
Total time for iteration 43: 4206<o:p></o:p>
Total time for iteration 44: 4777<o:p></o:p>
Total time for iteration 45: 4717<o:p></o:p>
Total time for iteration 46: 4607<o:p></o:p>
Total time for iteration 47: 4196<o:p></o:p>
Total time for iteration 48: 4796<o:p></o:p>
Total time for iteration 49: 4707<o:p></o:p>
Total time for iteration 50: 4777<o:p></o:p>
Total time for iteration 51: 4196<o:p></o:p>
Total time for iteration 52: 4627<o:p></o:p>
Total time for iteration 53: 4687<o:p></o:p>
Total time for iteration 54: 4806<o:p></o:p>
Total time for iteration 55: 4186<o:p></o:p>
Total time for iteration 56: 4627<o:p></o:p>
Total time for iteration 57: 4697<o:p></o:p>
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Is Eclipse IDE dying?In 2014 the Eclipse IDE is the leading development environment for Java with a market share of approximately 65%. but ac...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.