Posted by: leppie | August 24, 2007

Benchmarks updated

Earlier I posted some rather non technical benchmarking result. Also, the python times was compared in the interactive console. Here are the results running from the command line:

IronLisp: Build in release mode
Z:\dev\IronLisp\IronLisp\bin\Release>IronLisp.exe
time: 326.281ms
time: 303.722ms
time: 313.096ms
time: 304.353ms
time: 305.102ms

IronPython: Latest checkout, build in release mode
C:\dev\IronPython_Main\Bin\Release>ipy tak.py
Result: 7 Time: 0.763377747731
Result: 7 Time: 0.657344718393
Result: 7 Time: 0.655193607009
Result: 7 Time: 0.664234979585

Python 2.51
C:\Python25>python.exe -O tak.py
Result: 7 Time: 1.38913744624
Result: 7 Time: 1.38743890634
Result: 7 Time: 1.37719849869
Result: 7 Time: 1.37393355859

As you can see this paints a different picture. The picture is indeed very good as the DLR compiles most of the code. I tried running IronPython in ‘eval’ mode, but it seem to think about something forever :) (this didnt happen though previously when tested on the interactive console).

Here is the python code:

import time

def tak (x, y, z):
    if not(y < x):
        return z
    else:
        return tak(tak(x-1, y, z), tak(y-1, z, x), tak(z-1, x, y))

for i in range(4):
  t = time.clock()
  r = tak(24, 14, 6)
  t2 = time.clock()
  print "Result: ", r, "Time: ", (t2 - t)

dumb theme
And finally the IronLisp code (see that macro!!!):

(using System.Diagnostics)

(= tak (fn (x y z)
  (if (not (< y x))
    z
    (tak (tak (- x 1) y z)
         (tak (- y 1) z x)
         (tak (- z 1) x y) ))))

(= time (macro (x)
  `(do
      (= sw (startnew stopwatch))
      ,x
      (= ts (elapsed sw))
      (cwl "time: {0:f3}ms" (totalmilliseconds ts)))))

(to i 4
  (time (tak 24 14 6)))
About these ads

Responses

  1. You can make the CPython version significantly faster by using psyco. On my computer it ran more than 35 times faster than without psyco. Just install the psyco module and add the following lines after the import time statement.

    import psyco
    psyco.full()

    You can download psyco at http://sourceforge.net/project/showfiles.php?group_id=41036

    John

  2. Interesting :)

    Here are the comparable numbers:
    C:\Python25>python tak.py
    Result: 7 Time: 0.0792550449848
    Result: 7 Time: 0.0781764162764
    Result: 7 Time: 0.0818623596016
    Result: 7 Time: 0.0777285939973

    Wow!

    • Well the new HTC Thunderbolt is out now, my buddy just picked one up and while its very slick, it still has nothing on the next droid coming out around June. I think I’m going to wait for the Motorola Droid Bionic. Incase you haven’t heard about the Bioinic you can check out Maggie from Cnet http://news.cnet.com/8301-30686_3-20044444-266.html to read more. Awesome is coming in June!

  3. Here are comparative times for C#:

    C:\dev\tak\tak\bin\Release>tak.exe
    time: 57.141ms result: 7
    time: 46.176ms result: 7
    time: 46.313ms result: 7
    time: 49.795ms result: 7
    time: 46.579ms result: 7


Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: