"I have 100 billion dollars... You realize I could spend 3 million dollars a day, every day, for the next 100 years? And that's if I don't make another dime. Tell you what-I'll buy your right arm for a million dollars. I give you a million bucks, and I get to sever your arm right here." -Bill Gates



   
BentUser Updates Feed  Add BentUser to My MSN  Add BentUser to My Yahoo! 


Featured Articles
iPhone 3G Review, Gripes and Praise: Part I
Xbox Live Arcade 2008 Preview: Part I
Resident Evil 5 Preview
Customer Service?
The Fallout from Sony’s E3 Press Conference
Windows XP and Vista b5270 Side-by-Side
DRM Hell
Sharp XR-10X LCD Projector Review
Xbox 360 Launch
Microsoft BOB Review
Logitech V200 Wireless Notebook Mouse
Office 12 Screenshot Gallery
Apple Thinks Same, Goes Intel
Microsoft Windows Vista Build 5231 Indepth Look - Part 2
Why Google is Being Sued by Publishers
Microsoft Windows Vista Build 5231 Indepth Look - Part I
Comprehensive Tablet PC Review with the HP tc1100
Microsoft Virtual Server 2005 Review
IBM / Lenovo ThinkPad T43 Review
Windows OneCare Live Preview
OpenOffice 2.0 Writer Beta Preview
Windows Mobile 5.0 Preview
Battle of the Betas: IE7 vs. Firefox 1.5
Unicomp Customizer 101 Keyboard Review
Dell UltraSharp 24" Widescreen LCD Monitor - 2405FPW Review
Yahoo! Music Engine First Look
TopDesk Review
More
 
  .NET 2.0 vs. Java 1.5 Shootout
  By Andy

  Front > Software
  11/4/2005
  Specifications    Images    

 


 

One of the funny things about computer technology is the bitter industry rivalries that inevitably crop up.  There is probably no industry rivalry more bitter or hate-filled than that of .NET and Java.

While it is difficult to quantify definitively which platform is more flexible, easier to use, or easier to learn – we can certainly compare speed.  So, havn’t you always wondered – who’s faster: .NET or Java?

Last week, Microsoft released .NET 2.0, the long-awaited major-upgrade to .NET 1.1 – coinciding with the releases of Visual Studio 2005 and SQL Server 2005.  Armed with this new software, we set out to determine which is faster - .NET 2.0 or Java 1.5.

Test 1 – Selection Sort

Our first test will utilize the age-old textbook problem of computer sorting algorithms.  To thoroughly stress-test the two technology platforms, we chose a highly inefficient sorting algorithm – selection sort.  Selection sort is a method of sorting a list of items, typically numeric in nature, from say highest to lowest.  Because Java and C# are quite similar we were able to use the same selection sort code with extremely minor modification in Java and C#.

Selection sort is considered to be an inefficient sorting algorithm because its complexity in computer science terms is order n2.  This means that if you want to sort a list of 1,000 numbers it will take as many as 1,000,000 steps.  We chose selection sort because of its easy portability between C# and Java and – precisely because of its inefficiency and corresponding heavy use of memory – it will help to highlight any performance differences the two platforms. 

The following system was used as a testbed:

Component

Specifications

Processor

Pentium D 3.0 Ghz, 2 MB Cache

RAM

2 GB DDR2

Operating System

Windows XP Professional SP2 (Latest Patches, x32)

.NET Version

2.0.50727

Java Version

1.5.0 (J2SE)

Hard Disk (Not Important)

2x 250 GB 7200 RPM


So – you must be anxious to see the results.  Below is shown the running time in milliseconds of an ascending selection sort on a set of 1,000 descending floating point (double) numbers (the same data was used for .NET and Java).  Since this is running time, obviously less time is better.

Selection Sort on 1,000 Floating Point Elements, Time in MS
Selection Sort on 1,000 Floating Point Elements, Time in MS 

Now comes the interesting step – let’s scale the dataset up to 100,000 elements, pushing the complexity up to 10,000,000,000 steps:

Selection Sort on 100,000 Floating Point Elements, Time in MS
Selection Sort on 100,000 Floating Point Elements, Time in MS 

It looks like Test 1 has a clear winner - .NET 2.0.  Interestingly, the same general proportions between completion times for the two platforms remains similar – hence the same proportions portrayed in the graphs, despite the drastic increase in input size.  In the larger test, Java required 36,828 ms to complete the job, while .NET took 21,375 ms; .NET required only 58% of the time required by Java to complete the same task.  That’s nearly 2-to-1.




     Next  
[ Test 2, Memory Efficiency ]
 

 

Contact Us        Advertise   Links: Voguera  KayCircle      




Copyright © 2005 Retro Reviews LLC.  All Rights Reserved.
Technorati Profile