<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-241702134950246421</id><updated>2011-11-27T15:36:45.230-08:00</updated><category term='ruby'/><category term='python'/><category term='rails'/><title type='text'>railstooge</title><subtitle type='html'>Technology Victims</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://railstooge.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/241702134950246421/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://railstooge.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Tomáš Holas</name><uri>http://www.blogger.com/profile/15666174484325092471</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://2.bp.blogspot.com/_Xqb0oaK7D38/Sx42YstLTyI/AAAAAAAABU0/_cRVu2Hnxj0/S220/tom.png'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>2</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-241702134950246421.post-7565253026701555514</id><published>2009-01-23T12:03:00.000-08:00</published><updated>2009-01-24T13:05:05.736-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ruby'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>Ruby vs. Python - a lame benchmark.</title><content type='html'>I needed to write some code to merge two english-czech dictionaries. I'm a Rails-guy and Ruby is my language of choice for the time being. That said I now happen to write some of my projects in Python, because I was lured by the Google's App Engine (along with one of my customers). I expected that Python would be faster, so I've decided to write the code in Python for this reason. I also wanted to give an another try to Python scripting and learn some more Python on the way.  &lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I've written that script, and then I've became very curious. What is the actual speed-up? I had no other option, I had to rewrite it in Ruby as well. Because of my laziness I wanted to use the &lt;a href="http://code.google.com/p/ruby-ast/"&gt;python2ruby&lt;/a&gt; converter at first, but it didn't work for me. It took me some time to do the rewrite because of some of the small syntactical differences. &lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I have to admit, that in Python I like the semantic indentation and list comprehension. Everything else looks better in Ruby for me. I especially hate Python's inconsistent method calling. You write &lt;pre&gt;string.split(',')&lt;/pre&gt;that is quite normal. But when you want to join, you have to do it like this:&lt;br /&gt;&lt;pre&gt;','.join(array)&lt;/pre&gt; and for checking size, it's yet another way:&lt;pre&gt;len(array)&lt;/pre&gt;Also there was no way to check if array contains an item without using exceptions. I also had to use some ugly hacks to force Python to work correctly with UTF-8 strings. Please correct me if you know better, I'm still a Python noob. Anyway, I've finished the code and I ran it on a Core2Duo MacBook 1.6GHz. I used Python 2.5.2,  Ruby 1.8.7 and Ruby 1.9.0. I measured the time it took using the classic time command. The results were following:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;table border="1"&gt;&lt;tbody&gt;  &lt;/tbody&gt;&lt;tbody&gt;    &lt;!-- Results table headers --&gt;    &lt;tr&gt;      &lt;th&gt;Language&lt;/th&gt;      &lt;th&gt;User time (s)&lt;/th&gt;      &lt;th&gt;System time (s)&lt;/th&gt;      &lt;th&gt;CPU Load (%)&lt;/th&gt;      &lt;th&gt;Total time (s)&lt;/th&gt;    &lt;/tr&gt;    &lt;tr&gt;      &lt;td&gt;Python&lt;/td&gt;      &lt;td&gt;7.05&lt;/td&gt;      &lt;td&gt;0.37&lt;/td&gt;      &lt;td&gt;80&lt;/td&gt;      &lt;td&gt;9.204&lt;/td&gt;    &lt;/tr&gt;    &lt;tr&gt;      &lt;td&gt;Ruby 1.9&lt;/td&gt;      &lt;td&gt;10.65&lt;/td&gt;      &lt;td&gt;0.35&lt;/td&gt;      &lt;td&gt;77&lt;/td&gt;      &lt;td&gt;14.264&lt;/td&gt;    &lt;/tr&gt;    &lt;tr&gt;      &lt;td&gt;Ruby 1.8.7&lt;/td&gt;      &lt;td&gt;21.18&lt;/td&gt;      &lt;td&gt;4.93&lt;/td&gt;      &lt;td&gt;97&lt;/td&gt;      &lt;td&gt;26.776&lt;/td&gt;    &lt;/tr&gt;  &lt;/tbody&gt;&lt;tbody&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;We can see that Python is still faster than Ruby 1.9 in this benchmark, but not too significantly. Even Ruby 1.8 performs well enough for me to write those scripts in Ruby next time. I'm leaving the interpretation of system time and CPU Load to the more experienced, but i find it somewhat interesting. I could end with this, but I also wanted to give shot to Google's Chart API, so behold:&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;img src="http://chart.apis.google.com/chart?chtt=Total%20time&amp;amp;chts=000000,16&amp;amp;cht=bhg&amp;amp;chm=a|b|c&amp;amp;chs=500x125&amp;amp;chd=t:9.204|14.24|26.776&amp;amp;chds=0,30&amp;amp;chco=3366cc,ff0000,aa0000&amp;amp;chdl=Python|Ruby%201.9|Ruby%201.8.7&amp;amp;chxt=x&amp;amp;chxl=0:|0|10|20|" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src="http://chart.apis.google.com/chart?chtt=System%20time&amp;amp;chts=000000,16&amp;amp;cht=bhg&amp;amp;chm=a|b|c&amp;amp;chs=500x125&amp;amp;chd=t:0.37|0.35|4.93&amp;amp;chds=0,5&amp;amp;chco=3366cc,ff0000,aa0000&amp;amp;chdl=Python|Ruby%201.9|Ruby%201.8.7&amp;amp;chxt=x&amp;amp;chxl=0:|0|1|2|3|4|" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src="http://chart.apis.google.com/chart?chtt=CPU%20load&amp;amp;chts=000000,16&amp;amp;cht=bhg&amp;amp;chm=a|b|c&amp;amp;chs=500x125&amp;amp;chd=t:80|77|97&amp;amp;chds=0,100&amp;amp;chco=3366cc,ff0000,aa0000&amp;amp;chdl=Python|Ruby%201.9|Ruby%201.8.7&amp;amp;chxt=x" /&gt;&lt;br /&gt;&lt;br /&gt;Ok, we had enough nice graphs, so I'm saying goodbye to the lowhearted, and I'm going to expose the brave ones to the following ugly code: &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;span class="Apple-style-span"  style="font-size:x-large;"&gt;Python version:&lt;/span&gt;&lt;br /&gt;&lt;script src="http://gist.github.com/51156.js"&gt;&lt;/script&gt;&lt;br /&gt;&lt;span class="Apple-style-span"  style="font-size:x-large;"&gt;Ruby version:&lt;/span&gt;&lt;br /&gt;&lt;script src="http://gist.github.com/51158.js"&gt;&lt;/script&gt;&lt;br /&gt;For the non-enthusiast's among us: Can you spot 10 differences? Well.. that's all for today and I hope that you had some fun reading this post, because while creating it i had plenty...&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/241702134950246421-7565253026701555514?l=railstooge.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railstooge.blogspot.com/feeds/7565253026701555514/comments/default' title='Komentáře k příspěvku'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=241702134950246421&amp;postID=7565253026701555514&amp;isPopup=true' title='Počet komentářů: 3'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/241702134950246421/posts/default/7565253026701555514'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/241702134950246421/posts/default/7565253026701555514'/><link rel='alternate' type='text/html' href='http://railstooge.blogspot.com/2009/01/ruby-vs-python-lame-benchmark.html' title='Ruby vs. Python - a lame benchmark.'/><author><name>Tomáš Holas</name><uri>http://www.blogger.com/profile/15666174484325092471</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://2.bp.blogspot.com/_Xqb0oaK7D38/Sx42YstLTyI/AAAAAAAABU0/_cRVu2Hnxj0/S220/tom.png'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-241702134950246421.post-9115476270998279567</id><published>2008-06-11T01:51:00.000-07:00</published><updated>2009-01-24T13:04:05.084-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rails'/><title type='text'>Why Railstooge?</title><content type='html'>&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;div&gt;rails:&lt;/div&gt;&lt;/span&gt;an open source web application framework written in Ruby that aims to increase the speed and ease of web development&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;stooge:&lt;/span&gt;&lt;br /&gt;1. a person of unquestioning obedience [syn: flunky]&lt;br /&gt;2. a victim of ridicule or pranks [syn: butt]&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/241702134950246421-9115476270998279567?l=railstooge.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railstooge.blogspot.com/feeds/9115476270998279567/comments/default' title='Komentáře k příspěvku'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=241702134950246421&amp;postID=9115476270998279567&amp;isPopup=true' title='Počet komentářů: 0'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/241702134950246421/posts/default/9115476270998279567'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/241702134950246421/posts/default/9115476270998279567'/><link rel='alternate' type='text/html' href='http://railstooge.blogspot.com/2008/06/pro-railstooge.html' title='Why Railstooge?'/><author><name>Tomáš Holas</name><uri>http://www.blogger.com/profile/15666174484325092471</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://2.bp.blogspot.com/_Xqb0oaK7D38/Sx42YstLTyI/AAAAAAAABU0/_cRVu2Hnxj0/S220/tom.png'/></author><thr:total>0</thr:total></entry></feed>
