From: Dave Burt Date: 2005-11-14T23:57:15+09:00 Subject: Re: win32ole --Test-- Ruby vs. Python greg.rb wrote: > I was suprised that Ruby 200% faster verses the 'static' generated > Python com object. The Python 'dynamic' was even slower so I won't > mention it's time. Psyco will not help this task either, in fact it > slows it down to 9.2 seconds. > > Average of 3 runs- Python time:6.16 > Average of 3 runs- Ruby time:2.89 > Ruby was 200% faster-Chunky Bacon! > For this specific task, I am sorry to say "Python you're fired". Wow - that's quite a surprising disparity. Also surprising is the fact you mentioned in the old thread but not here, that the "static" generated Ruby version (using olegen.rb) was slower than the straight dynamic WIN32OLE code. Might there be a relationship? Might Python's time difference also be in the initial loading? What do you get if you loop and repeat from .Open to ..Close, say, 20 times? (The Ruby version takes about 20 times as long to do that.) And yet another surprise: Ruby out-performs the Windows Scripting Host, too, with this test: Excel 1000 cells total is 25 Apr 5894 VBScript Elapsed 3.359375 (The VBScript:) t= Timer Set xlApp = CreateObject("Excel.Application") xl_file = "test.xls" xlApp.Workbooks.Open xl_file excel_cells_total = 0.0 For r = 1 To 1000 xlcell = xlApp.Cells(r,1).Value excel_cells_total = excel_cells_total + xlcell Next xlApp.ActiveWorkbook.Close() xlApp.Quit WScript.Echo "Excel 1000 cells total is ", excel_cells_total WScript.Echo "VBScript Elapsed ", (Timer - t) Cheers, Dave