<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Python recursion performance test</title>
	<atom:link href="http://www.ahmedsoliman.com/2009/07/15/python-recursion-performance-test/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ahmedsoliman.com/2009/07/15/python-recursion-performance-test/</link>
	<description>{yet another technology geek!}</description>
	<lastBuildDate>Fri, 20 Jan 2012 20:02:52 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: soji</title>
		<link>http://www.ahmedsoliman.com/2009/07/15/python-recursion-performance-test/comment-page-1/#comment-65728</link>
		<dc:creator>soji</dc:creator>
		<pubDate>Mon, 18 Jul 2011 17:18:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.ahmedsoliman.com/?p=425#comment-65728</guid>
		<description>&quot;the real reason behind why python is really slow there is the cost of function calls, in C function calls are simple JMP but in python there is the scope namespace search and stack handling and it’s really cost. so the trick is that if you want faster execution times in situations where you want thousand of direct function calls, use loops instead.&quot;

thanks for the info: in my program it took C 8mins to execute, while for Python I simply had to terminate after an hour.</description>
		<content:encoded><![CDATA[<p>&#8220;the real reason behind why python is really slow there is the cost of function calls, in C function calls are simple JMP but in python there is the scope namespace search and stack handling and it’s really cost. so the trick is that if you want faster execution times in situations where you want thousand of direct function calls, use loops instead.&#8221;</p>
<p>thanks for the info: in my program it took C 8mins to execute, while for Python I simply had to terminate after an hour.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Naresh</title>
		<link>http://www.ahmedsoliman.com/2009/07/15/python-recursion-performance-test/comment-page-1/#comment-20523</link>
		<dc:creator>Naresh</dc:creator>
		<pubDate>Fri, 09 Apr 2010 03:48:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.ahmedsoliman.com/?p=425#comment-20523</guid>
		<description>Iam not understanding what you are saying if i execut it iam not getting output it terminates the programm could you help me in recursions?</description>
		<content:encoded><![CDATA[<p>Iam not understanding what you are saying if i execut it iam not getting output it terminates the programm could you help me in recursions?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ahmed S. Farghal</title>
		<link>http://www.ahmedsoliman.com/2009/07/15/python-recursion-performance-test/comment-page-1/#comment-13776</link>
		<dc:creator>Ahmed S. Farghal</dc:creator>
		<pubDate>Thu, 15 Oct 2009 19:32:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.ahmedsoliman.com/?p=425#comment-13776</guid>
		<description>I may agree that PHP and ASP are pretty slow but Python is not slow, but it depends on your code more than compiled languages (talking java here) because the compiler there is capable of doing more advanced optimizations than interpreter. 

It really worth reading so you can see how your code can make a difference http://wiki.python.org/moin/PythonSpeed/PerformanceTips

Thanks for you comment.</description>
		<content:encoded><![CDATA[<p>I may agree that PHP and ASP are pretty slow but Python is not slow, but it depends on your code more than compiled languages (talking java here) because the compiler there is capable of doing more advanced optimizations than interpreter. </p>
<p>It really worth reading so you can see how your code can make a difference <a href="http://wiki.python.org/moin/PythonSpeed/PerformanceTips" rel="nofollow">http://wiki.python.org/moin/PythonSpeed/PerformanceTips</a></p>
<p>Thanks for you comment.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: elvispresley</title>
		<link>http://www.ahmedsoliman.com/2009/07/15/python-recursion-performance-test/comment-page-1/#comment-13774</link>
		<dc:creator>elvispresley</dc:creator>
		<pubDate>Thu, 15 Oct 2009 19:24:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.ahmedsoliman.com/?p=425#comment-13774</guid>
		<description>Python is slow.    

There is no doubt that Python is a very powerful language but it is also a very slow language.   

It is okay for PHP or ASP to be slow because PHP and ASP do not pretend to be advanced languages and both are very easy to learn and program.      But Python is supposed to be a very powerful language - and so how can it be so slow?  (and I am not comparing it with C or any other compiled language).</description>
		<content:encoded><![CDATA[<p>Python is slow.    </p>
<p>There is no doubt that Python is a very powerful language but it is also a very slow language.   </p>
<p>It is okay for PHP or ASP to be slow because PHP and ASP do not pretend to be advanced languages and both are very easy to learn and program.      But Python is supposed to be a very powerful language &#8211; and so how can it be so slow?  (and I am not comparing it with C or any other compiled language).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: To Understand Recursion You Need To Understand Recursion&#8230; &#171; Another Geek from Cairo</title>
		<link>http://www.ahmedsoliman.com/2009/07/15/python-recursion-performance-test/comment-page-1/#comment-10781</link>
		<dc:creator>To Understand Recursion You Need To Understand Recursion&#8230; &#171; Another Geek from Cairo</dc:creator>
		<pubDate>Sat, 01 Aug 2009 01:20:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.ahmedsoliman.com/?p=425#comment-10781</guid>
		<description>[...] solution, since as my colleague, Ahmed Soliman, rightly concluded that recursion in Python is slow. (An interesting argument can be found here as [...]</description>
		<content:encoded><![CDATA[<p>[...] solution, since as my colleague, Ahmed Soliman, rightly concluded that recursion in Python is slow. (An interesting argument can be found here as [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nicolas Trangez: Re: Python recursion performance test &#124; Full-Linux.com</title>
		<link>http://www.ahmedsoliman.com/2009/07/15/python-recursion-performance-test/comment-page-1/#comment-10026</link>
		<dc:creator>Nicolas Trangez: Re: Python recursion performance test &#124; Full-Linux.com</dc:creator>
		<pubDate>Sat, 18 Jul 2009 06:02:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.ahmedsoliman.com/?p=425#comment-10026</guid>
		<description>[...] is a reply on a post by Ahmed Soliman on recursion performance in (C)Python, and CPython function call overhead in [...]</description>
		<content:encoded><![CDATA[<p>[...] is a reply on a post by Ahmed Soliman on recursion performance in (C)Python, and CPython function call overhead in [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nicolas Trangez</title>
		<link>http://www.ahmedsoliman.com/2009/07/15/python-recursion-performance-test/comment-page-1/#comment-9986</link>
		<dc:creator>Nicolas Trangez</dc:creator>
		<pubDate>Thu, 16 Jul 2009 01:09:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.ahmedsoliman.com/?p=425#comment-9986</guid>
		<description>Replied at http://eikke.com/re-python-recursion-performance-test/ ;-)</description>
		<content:encoded><![CDATA[<p>Replied at <a href="http://eikke.com/re-python-recursion-performance-test/" rel="nofollow">http://eikke.com/re-python-recursion-performance-test/</a> <img src='http://www.ahmedsoliman.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mohamed Fawzy</title>
		<link>http://www.ahmedsoliman.com/2009/07/15/python-recursion-performance-test/comment-page-1/#comment-9980</link>
		<dc:creator>Mohamed Fawzy</dc:creator>
		<pubDate>Wed, 15 Jul 2009 15:01:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.ahmedsoliman.com/?p=425#comment-9980</guid>
		<description>I agree that in general,recursion is very slow in all programming languages due to the time it take in function call and the language that handle functions calls efficiently can perform recursions in high speed.

But in some situations recursion is similar to looping in run time plus the code of recursion is fewer and more readable.

There are some problems like binary search,tree searching and sorting ,tower of Hanoi,...etc we used to solve it recursively and i will be very complicated in traditional looping approach.

I see that dynamic programming is efficient here but in other situations generating a list of million number to catch one number doesn&#039;t make any sense and consuming resources.

I simply want to say that we can&#039;t neglect recursion approach as it may be the best solution.

Thanks Eng. Ahmed</description>
		<content:encoded><![CDATA[<p>I agree that in general,recursion is very slow in all programming languages due to the time it take in function call and the language that handle functions calls efficiently can perform recursions in high speed.</p>
<p>But in some situations recursion is similar to looping in run time plus the code of recursion is fewer and more readable.</p>
<p>There are some problems like binary search,tree searching and sorting ,tower of Hanoi,&#8230;etc we used to solve it recursively and i will be very complicated in traditional looping approach.</p>
<p>I see that dynamic programming is efficient here but in other situations generating a list of million number to catch one number doesn&#8217;t make any sense and consuming resources.</p>
<p>I simply want to say that we can&#8217;t neglect recursion approach as it may be the best solution.</p>
<p>Thanks Eng. Ahmed</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ahmed S. Farghal</title>
		<link>http://www.ahmedsoliman.com/2009/07/15/python-recursion-performance-test/comment-page-1/#comment-9978</link>
		<dc:creator>Ahmed S. Farghal</dc:creator>
		<pubDate>Wed, 15 Jul 2009 12:32:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.ahmedsoliman.com/?p=425#comment-9978</guid>
		<description>Yes abdul fattah, tail recursion is one way to &#039;optimize&#039; but in fact this is not what I&#039;m talking about, I&#039;m not talking about how to write this particular function, I know many many ways of optimization there but that trick showed the cost of calling functions in python and illustrated it quite clearly.</description>
		<content:encoded><![CDATA[<p>Yes abdul fattah, tail recursion is one way to &#8216;optimize&#8217; but in fact this is not what I&#8217;m talking about, I&#8217;m not talking about how to write this particular function, I know many many ways of optimization there but that trick showed the cost of calling functions in python and illustrated it quite clearly.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Abdul-Fattah</title>
		<link>http://www.ahmedsoliman.com/2009/07/15/python-recursion-performance-test/comment-page-1/#comment-9977</link>
		<dc:creator>Abdul-Fattah</dc:creator>
		<pubDate>Wed, 15 Jul 2009 12:27:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.ahmedsoliman.com/?p=425#comment-9977</guid>
		<description>hey Ahmed, how are you? I got sometime to write function in python because I didn&#039;t try it before. But my point here is Recursion is too slow in all programming language. So you should use Tail Recursion instead

def fib(x):
    if x &gt; 0:
        fib_help(x, 0, 1);
    else:
        print(&quot;Please Enter value more than zero&quot;);
def fib_help(x, result, next):
    if x == 0:
        print(result);
    else:
        fib_help(x-1, next, result + next);

This function will work fine, and the performance will be good, and like I said to you before about Erlang programming Language that in the latest release Recursion and Tail recursion has the same performance, but I didn&#039;t try it yet, but I will when I will have time.

I&#039;m beginner in Python, so excuse my Code :$</description>
		<content:encoded><![CDATA[<p>hey Ahmed, how are you? I got sometime to write function in python because I didn&#8217;t try it before. But my point here is Recursion is too slow in all programming language. So you should use Tail Recursion instead</p>
<p>def fib(x):<br />
    if x &gt; 0:<br />
        fib_help(x, 0, 1);<br />
    else:<br />
        print(&#8220;Please Enter value more than zero&#8221;);<br />
def fib_help(x, result, next):<br />
    if x == 0:<br />
        print(result);<br />
    else:<br />
        fib_help(x-1, next, result + next);</p>
<p>This function will work fine, and the performance will be good, and like I said to you before about Erlang programming Language that in the latest release Recursion and Tail recursion has the same performance, but I didn&#8217;t try it yet, but I will when I will have time.</p>
<p>I&#8217;m beginner in Python, so excuse my Code :$</p>
]]></content:encoded>
	</item>
</channel>
</rss>

