The Artima Developer Community
Sponsored Link

Agile Buzz Forum
Smalltalk performance vs. C#

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
James Robertson

Posts: 29924
Nickname: jarober61
Registered: Jun, 2003

David Buck, Smalltalker at large
Smalltalk performance vs. C# Posted: Apr 21, 2007 6:15 AM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by James Robertson.
Original Post: Smalltalk performance vs. C#
Feed Title: David Buck - Blog
Feed URL: http://www.cincomsmalltalk.com/rssBlog/buck-rss.xml
Feed Description: Smalltalk can do that
Latest Agile Buzz Posts
Latest Agile Buzz Posts by James Robertson
Latest Posts From David Buck - Blog

Advertisement

Many years ago, I wrote a number of benchmarks to test Smalltalk's performance against C++. At the time, it compared quite favorably. I've recently re-run the comparison but this time against C#. The results are quite interesting.

First, each benchmark is designed to test one specific kind of operation. I've formulated each benchmark to prevent the compiler from optimizing out what I'm trying to measure. For example, if my test said x = 5 * 7 + 3 + 2, then a smart compiler would just perform all the calculations at compile time and assign one integer to the variable. This is clearly not what I want to measure.

For most of the tests, I've repeated the test code many times inside a loop in order to reduce the impact of the loop overhead on the test. This isn't perfect, but it helps. All time measurements are elapsed time on an otherwise idle system.

Benchmark:    Integer Arithmetic
  Operations: 4,000,000,000
  Smalltalk:  23 seconds
  C#:         10 seconds
 
Benchmark:     OrderedCollection write
   Operations: 1,000,000,000
   Smalltalk:  51 seconds
   C#:         40 seconds (using ArrayList for C#)
 
Benchmark:     Dictionary write
   Operations: 100,000,000 
   Smalltalk:  22 seconds
   C#:         11 seconds (using Hashtable for C#)
 
Benchmark:     Towers of Hanoi (to test message send speed)
   Operations: 2**30 (a tower of 30 disks)
   Smalltalk:  19 seconds
   C#:         14 seconds
 
Benchmark:     Memory allocation
   Operations: 1,000,000,000
   Smalltalk:  13.4 seconds
   C#:         12 seconds
 
Benchmark:     Iteration through an OrderedCollection
   Operations: 100,000,000
   Smalltalk:  32.5 seconds
   C#:         36 seconds
  
 

One more note about the Integer Arithmetic benchmark. C# is smart enough to move memory variables to registers at the start of the method and then just perform the arithmetic in the registers. This isn't really typical behavior in a real system where the arithmetic operations are scattered throughout the system. In order to make it more fair, I made the variables into instance variables and marked them as volatile to force C# to fetch and write them all the time. This makes the comparison to Smalltalk much more fair.

Overall, I'd say that Smalltalk compares quite favorably in performance versus C# (VisualStudio 2003 version compiling as Release to get better optimization).

Read: Smalltalk performance vs. C#

Topic: Silverlight Vs. Apollo Previous Topic   Next Topic Topic: Clipper story

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use