<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: C++ vs. Python vs. Perl vs. PHP performance benchmark</title>
	<atom:link href="http://blog.famzah.net/2010/07/01/cpp-vs-python-vs-perl-vs-php-performance-benchmark/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.famzah.net/2010/07/01/cpp-vs-python-vs-perl-vs-php-performance-benchmark/</link>
	<description>Enthusiasm never stops</description>
	<lastBuildDate>Tue, 07 May 2013 13:41:19 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Ivan Zahariev</title>
		<link>http://blog.famzah.net/2010/07/01/cpp-vs-python-vs-perl-vs-php-performance-benchmark/#comment-5040</link>
		<dc:creator><![CDATA[Ivan Zahariev]]></dc:creator>
		<pubDate>Tue, 26 Feb 2013 09:59:26 +0000</pubDate>
		<guid isPermaLink="false">http://blog.famzah.net/?p=732#comment-5040</guid>
		<description><![CDATA[Here are some more benchmarks between C/C++/Python/Python+Pypy/Perl for reading and analyzing data files: http://blog.lifepattern.org/2013/02/17/apache-traffic-by-vhost-quick-programming-language-comparison/]]></description>
		<content:encoded><![CDATA[<p>Here are some more benchmarks between C/C++/Python/Python+Pypy/Perl for reading and analyzing data files: <a href="http://blog.lifepattern.org/2013/02/17/apache-traffic-by-vhost-quick-programming-language-comparison/" rel="nofollow">http://blog.lifepattern.org/2013/02/17/apache-traffic-by-vhost-quick-programming-language-comparison/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ivan Zahariev</title>
		<link>http://blog.famzah.net/2010/07/01/cpp-vs-python-vs-perl-vs-php-performance-benchmark/#comment-4983</link>
		<dc:creator><![CDATA[Ivan Zahariev]]></dc:creator>
		<pubDate>Thu, 21 Feb 2013 12:31:44 +0000</pubDate>
		<guid isPermaLink="false">http://blog.famzah.net/?p=732#comment-4983</guid>
		<description><![CDATA[Correct. But the idea here is to benchmark how fast is the language itself. That&#039;s why we run all tests in a single thread.]]></description>
		<content:encoded><![CDATA[<p>Correct. But the idea here is to benchmark how fast is the language itself. That&#8217;s why we run all tests in a single thread.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Victor</title>
		<link>http://blog.famzah.net/2010/07/01/cpp-vs-python-vs-perl-vs-php-performance-benchmark/#comment-4975</link>
		<dc:creator><![CDATA[Victor]]></dc:creator>
		<pubDate>Mon, 18 Feb 2013 14:22:18 +0000</pubDate>
		<guid isPermaLink="false">http://blog.famzah.net/?p=732#comment-4975</guid>
		<description><![CDATA[You can use multiprocessing, try this python source:

[sourcecode language=&quot;python&quot; collapse=&quot;true&quot;]
import time

from multiprocessing import Process

def get_primes7(n):

    &quot;&quot;&quot; standard optimized sieve algorithm to get a list of prime numbers
    --- this is the function to compare your functions against! --- &quot;&quot;&quot;
    if n &lt; 2:  return []
    if n == 2: return [2]
    # do only odd numbers starting at 3
    s = range(3, n+1, 2)
    # n**0.5 simpler than math.sqr(n)
    mroot = n ** 0.5
    half = len(s)
    i = 0
    m = 3
    while m &lt;= mroot:
        if s[i]:
            j = (m*m-3)/2  # int div
            s[j] = 0
            while j &lt; half:
                s[j] = 0
                j += m
        i = i+1
        m = 2*i+3
        res = [2]+[x for x in s if x]
        print &quot;Found&quot;, len(res), &quot;prime numbers.&quot;
        return res


t1 = time.time()
for t in range(10):
    print &quot;start: &quot;
    Process(target=get_primes7, args=(10000000,)).start()
t2 = time.time()
print &#039;Execution of all threads is complete, time: %.2f&#039; % (t2-t1)

t1 = time.time()

[/sourcecode]]]></description>
		<content:encoded><![CDATA[<p>You can use multiprocessing, try this python source:</p>
<pre class="brush: python; collapse: true; light: false; title: ; toolbar: true; notranslate">
import time

from multiprocessing import Process

def get_primes7(n):

    &quot;&quot;&quot; standard optimized sieve algorithm to get a list of prime numbers
    --- this is the function to compare your functions against! --- &quot;&quot;&quot;
    if n &amp;lt; 2:  return []
    if n == 2: return [2]
    # do only odd numbers starting at 3
    s = range(3, n+1, 2)
    # n**0.5 simpler than math.sqr(n)
    mroot = n ** 0.5
    half = len(s)
    i = 0
    m = 3
    while m &amp;lt;= mroot:
        if s[i]:
            j = (m*m-3)/2  # int div
            s[j] = 0
            while j &amp;lt; half:
                s[j] = 0
                j += m
        i = i+1
        m = 2*i+3
        res = [2]+[x for x in s if x]
        print &amp;quot;Found&amp;quot;, len(res), &amp;quot;prime numbers.&amp;quot;
        return res


t1 = time.time()
for t in range(10):
    print &amp;quot;start: &amp;quot;
    Process(target=get_primes7, args=(10000000,)).start()
t2 = time.time()
print &#039;Execution of all threads is complete, time: %.2f&#039; % (t2-t1)

t1 = time.time()

</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rick</title>
		<link>http://blog.famzah.net/2010/07/01/cpp-vs-python-vs-perl-vs-php-performance-benchmark/#comment-4925</link>
		<dc:creator><![CDATA[Rick]]></dc:creator>
		<pubDate>Sat, 26 Jan 2013 08:03:26 +0000</pubDate>
		<guid isPermaLink="false">http://blog.famzah.net/?p=732#comment-4925</guid>
		<description><![CDATA[Benchmarks are all well and fine but as time has shown such matters are very dependent on exactly what type of application is being developed.

Getting VERY dirty would mean, guess what, use assembler.  A dedicated webserver with your application coded native in assembler.  It will make C++ look like its standing still, but is it practical?  Is it practical on a Linux or Windows box?  No. And Yes.  How bi-polar of me. It DEPENDS on what one need accomplish.  If I care try distributing hundreds of thousands of incoming connections on a singular connection server and send them off where they need go, yes, assembler is going to perform far better than say a C++ solution.

Same is true of Web Applications.  C++ / Java are clear winners in performance. But are they or which is more practical?  A native high traffic say auction venue C++ or Java are up to the task.  eBay uses C++ and of course, oodles of connection servers, database servers etc. Dedicated machines as does Amazon.

However, eBay&#039;s or Amazons help or forums, or even static forms of pages need not get all performance freaky.

PHP and Apache Web Server are coded in C++.  That in itself should (but doesnt) quell the PHP&#039;rs who go, &quot;PHP is the way to go for just about everything&quot;.  Its not.

Python, Ruby and other more vertical languages also have a their areas where they do quite well.  Point being, planning ahead of time and understanding WHICH is best for a suited application is important. Very important.

In enterprise levels, C++, Java and Microsofts C# and subsequent oodles of CONSISTENCY supported applications are the clear choices.

C++ tends power the biggest complex, high traffic and gobs of DB query based sites on the net. Its the worst to maintain but yields best results.  Java is used widely in enterprise applications, LOTS (I mean lots) of Points Of Sale systems accessible via terminals, online etc.  In your AT&amp;T store, Verizon, Walmarts etc.  All Java.  Regional inventory push/pull systems for the likes of Walmart, Target on and on, all Java.  Java is fast and yes, tends be more maintainable than C++.

Microsoft as noted, gobs of applications supported consistently.  .NET gives a enterprise the ability of desktop, client/server, use of ANY language in support of .NET (VB, C#, many others, even Cobol by other ISV&#039;s) not to mention things such as Office (Word, Excel,etc), Sharepoint, on and on and on.

The handoff in all of this is development time, deployment, scalability, performance etc.  We all know this as developers.

But what we as developers often DONT take into account is the future of HARDWARE.

This is actually where Microsoft is smart.  Code generated, inefficient as the bloated beast .NET, Windows, SQL Server etc. are... Microsoft is banking on hardware coming to them.  That is to say, Hardware performance will give them &quot;the edge&quot; in time.  I believe they are right assuming the global economy doesnt collapse.

Eventually SSD&#039;s will rid the world of mechanical drives and this will be an enormous leap across the board as we end up with enormous SSD drives with enormous data and addressing busses.

Enterprise level applications (on web/off web / client/server) will no longer need concern themselves with efficiency.  We see this on Desktop PC usage and have for years.  Linux is far more efficient than Windows or Windows Server, but, people in their homes choose Windows and pay for it .vs. free Linux.  People pay for Mac&#039;s w/ OS/X .vs. Linux.

Many development companies have tried to support Linux in commercial applications for home and business and sales just dont make it.  As they say in a community, people who use free things tend to expect often free things.  Dunno.

Eventually everything will end up in &quot;the cloud&quot; happily piped in to our home entertainment centers which are TV, Stereo, Computer, Game Machine etc etc all in one.  People will pay, be happy (perhaps controlled) and then some.

But the software technology that sits behind that revolution when it happens?  More than likely you will see Microsofts name on it.

There comes a time in other words where efficiency and all the compu-jibe becomes immaterial.  This is the case with home computing, the Windows or Mac PC&#039;s.  If I were to take count of all the PC&#039;s in say southern California and what OS they run the numbers would outpace every home linux installation and mac install in the world, perhaps more than both combined.  Sad perhaps, but surely true.

In business and webs this is not the case.  Not yet.  But as the Net connectivity, hardware technologies continue to evolve naturally the same thing will occur.  Businesses will go, &quot;We want what works and gives us the most options to grow and is the LEAST complex for US to use daily&quot;.  That will be IMHO Microsoft who has continually now for years and years on end been advancing software technologies albeit not caring about efficiency as a &quot;practical goal&quot; as they consider efficiency of the shall we say &quot;server based&quot; technologies to become extinct as they have in home computing and even console gaming systems coding etc.  Thus expending oodles of resources to make everything Microsoft efficient is simply wasting ones time as eventually the hardware technologies will make it moot as it has in home computing.  Further, the cost of this hardware ALWAYS goes downward in time.

Hosting companies dont like talking about it.  You dont see for example hosts of hosts offering 10 year old dedicated servers at costs of shared hosting packages.  No No. Yet, those machines would do more for ones growing and slowing PHP based web(s) than any nifty new shared box they sit upon.

I recently deployed a site for some folks (PHP CMS deal) to a decent VPS host.  Site runs fine.  Sits on a machine thats a quad core zip zip machine.  Know what?  The AMD 1700 (yes you read that right)  based machine I have LAMP on (and not loaded over a LAN but the net) runs RINGS around it and that 1700 has considerably more running on it than the slimmed down VPS.  Sure... there are all forms of differences at play, but the results are quite dramatic.  I&#039;d benchmark it but again, doesnt matter.  What matters is they got their site and are happy.

Ok, one last gripe?  About some of the &quot;biggie names&quot; in open source.  The Magento&#039;s and Joomla&#039;s etc.

Here are these weenies who develop these PHP based applications that are essentially not any better than similar applications that abound, in fact worse than many.  But, they have a community of developers which make the software do lots of nifty things.  Modules, plugins etc.  Then THEY capitalize be it by making editions for &quot;those who need pay for things&quot; or jetsetting around the globe selling everyone on how wonderful they and their works are charging for seminars!

I call it &quot;Open-a__&quot; developers.

Perhaps brilliant in using others to become millionaires themselves and famous? LOL.

But ya know, I never see them or hear of em&#039; banging out say open source C++ frameworks, Java ones, those that are considered by the WORLD as PERFORMANCE based technologies etc.  Uh Uh.  IMHO and I know PHP its a mess, just a mess. 

For example, look at Liferay (not sure if its still free these days) and Joomla or Drupal.  Install em&#039;.  Use some nice profiling software and then pick your jaw up off the ground when you see the performance curves.

But see... again, doesnt seem to matter.  Whats actually best, most efficient this/that becomes moot in the face of the masses.]]></description>
		<content:encoded><![CDATA[<p>Benchmarks are all well and fine but as time has shown such matters are very dependent on exactly what type of application is being developed.</p>
<p>Getting VERY dirty would mean, guess what, use assembler.  A dedicated webserver with your application coded native in assembler.  It will make C++ look like its standing still, but is it practical?  Is it practical on a Linux or Windows box?  No. And Yes.  How bi-polar of me. It DEPENDS on what one need accomplish.  If I care try distributing hundreds of thousands of incoming connections on a singular connection server and send them off where they need go, yes, assembler is going to perform far better than say a C++ solution.</p>
<p>Same is true of Web Applications.  C++ / Java are clear winners in performance. But are they or which is more practical?  A native high traffic say auction venue C++ or Java are up to the task.  eBay uses C++ and of course, oodles of connection servers, database servers etc. Dedicated machines as does Amazon.</p>
<p>However, eBay&#8217;s or Amazons help or forums, or even static forms of pages need not get all performance freaky.</p>
<p>PHP and Apache Web Server are coded in C++.  That in itself should (but doesnt) quell the PHP&#8217;rs who go, &#8220;PHP is the way to go for just about everything&#8221;.  Its not.</p>
<p>Python, Ruby and other more vertical languages also have a their areas where they do quite well.  Point being, planning ahead of time and understanding WHICH is best for a suited application is important. Very important.</p>
<p>In enterprise levels, C++, Java and Microsofts C# and subsequent oodles of CONSISTENCY supported applications are the clear choices.</p>
<p>C++ tends power the biggest complex, high traffic and gobs of DB query based sites on the net. Its the worst to maintain but yields best results.  Java is used widely in enterprise applications, LOTS (I mean lots) of Points Of Sale systems accessible via terminals, online etc.  In your AT&amp;T store, Verizon, Walmarts etc.  All Java.  Regional inventory push/pull systems for the likes of Walmart, Target on and on, all Java.  Java is fast and yes, tends be more maintainable than C++.</p>
<p>Microsoft as noted, gobs of applications supported consistently.  .NET gives a enterprise the ability of desktop, client/server, use of ANY language in support of .NET (VB, C#, many others, even Cobol by other ISV&#8217;s) not to mention things such as Office (Word, Excel,etc), Sharepoint, on and on and on.</p>
<p>The handoff in all of this is development time, deployment, scalability, performance etc.  We all know this as developers.</p>
<p>But what we as developers often DONT take into account is the future of HARDWARE.</p>
<p>This is actually where Microsoft is smart.  Code generated, inefficient as the bloated beast .NET, Windows, SQL Server etc. are&#8230; Microsoft is banking on hardware coming to them.  That is to say, Hardware performance will give them &#8220;the edge&#8221; in time.  I believe they are right assuming the global economy doesnt collapse.</p>
<p>Eventually SSD&#8217;s will rid the world of mechanical drives and this will be an enormous leap across the board as we end up with enormous SSD drives with enormous data and addressing busses.</p>
<p>Enterprise level applications (on web/off web / client/server) will no longer need concern themselves with efficiency.  We see this on Desktop PC usage and have for years.  Linux is far more efficient than Windows or Windows Server, but, people in their homes choose Windows and pay for it .vs. free Linux.  People pay for Mac&#8217;s w/ OS/X .vs. Linux.</p>
<p>Many development companies have tried to support Linux in commercial applications for home and business and sales just dont make it.  As they say in a community, people who use free things tend to expect often free things.  Dunno.</p>
<p>Eventually everything will end up in &#8220;the cloud&#8221; happily piped in to our home entertainment centers which are TV, Stereo, Computer, Game Machine etc etc all in one.  People will pay, be happy (perhaps controlled) and then some.</p>
<p>But the software technology that sits behind that revolution when it happens?  More than likely you will see Microsofts name on it.</p>
<p>There comes a time in other words where efficiency and all the compu-jibe becomes immaterial.  This is the case with home computing, the Windows or Mac PC&#8217;s.  If I were to take count of all the PC&#8217;s in say southern California and what OS they run the numbers would outpace every home linux installation and mac install in the world, perhaps more than both combined.  Sad perhaps, but surely true.</p>
<p>In business and webs this is not the case.  Not yet.  But as the Net connectivity, hardware technologies continue to evolve naturally the same thing will occur.  Businesses will go, &#8220;We want what works and gives us the most options to grow and is the LEAST complex for US to use daily&#8221;.  That will be IMHO Microsoft who has continually now for years and years on end been advancing software technologies albeit not caring about efficiency as a &#8220;practical goal&#8221; as they consider efficiency of the shall we say &#8220;server based&#8221; technologies to become extinct as they have in home computing and even console gaming systems coding etc.  Thus expending oodles of resources to make everything Microsoft efficient is simply wasting ones time as eventually the hardware technologies will make it moot as it has in home computing.  Further, the cost of this hardware ALWAYS goes downward in time.</p>
<p>Hosting companies dont like talking about it.  You dont see for example hosts of hosts offering 10 year old dedicated servers at costs of shared hosting packages.  No No. Yet, those machines would do more for ones growing and slowing PHP based web(s) than any nifty new shared box they sit upon.</p>
<p>I recently deployed a site for some folks (PHP CMS deal) to a decent VPS host.  Site runs fine.  Sits on a machine thats a quad core zip zip machine.  Know what?  The AMD 1700 (yes you read that right)  based machine I have LAMP on (and not loaded over a LAN but the net) runs RINGS around it and that 1700 has considerably more running on it than the slimmed down VPS.  Sure&#8230; there are all forms of differences at play, but the results are quite dramatic.  I&#8217;d benchmark it but again, doesnt matter.  What matters is they got their site and are happy.</p>
<p>Ok, one last gripe?  About some of the &#8220;biggie names&#8221; in open source.  The Magento&#8217;s and Joomla&#8217;s etc.</p>
<p>Here are these weenies who develop these PHP based applications that are essentially not any better than similar applications that abound, in fact worse than many.  But, they have a community of developers which make the software do lots of nifty things.  Modules, plugins etc.  Then THEY capitalize be it by making editions for &#8220;those who need pay for things&#8221; or jetsetting around the globe selling everyone on how wonderful they and their works are charging for seminars!</p>
<p>I call it &#8220;Open-a__&#8221; developers.</p>
<p>Perhaps brilliant in using others to become millionaires themselves and famous? LOL.</p>
<p>But ya know, I never see them or hear of em&#8217; banging out say open source C++ frameworks, Java ones, those that are considered by the WORLD as PERFORMANCE based technologies etc.  Uh Uh.  IMHO and I know PHP its a mess, just a mess. </p>
<p>For example, look at Liferay (not sure if its still free these days) and Joomla or Drupal.  Install em&#8217;.  Use some nice profiling software and then pick your jaw up off the ground when you see the performance curves.</p>
<p>But see&#8230; again, doesnt seem to matter.  Whats actually best, most efficient this/that becomes moot in the face of the masses.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ivan Zahariev</title>
		<link>http://blog.famzah.net/2010/07/01/cpp-vs-python-vs-perl-vs-php-performance-benchmark/#comment-4892</link>
		<dc:creator><![CDATA[Ivan Zahariev]]></dc:creator>
		<pubDate>Fri, 11 Jan 2013 10:59:31 +0000</pubDate>
		<guid isPermaLink="false">http://blog.famzah.net/?p=732#comment-4892</guid>
		<description><![CDATA[Hi,

Here are the benchmark on my system:
* nodejs (0.6.12): 5,724 s
* Ruby (1.9.3): 23,085 s
* Python (2.7.3): 31,294 s

If we linearly adjust the above times with a coefficient of &quot;0,88&quot; so that they match the already done benchmarks in the blog post, we get the following numbers:
* nodejs (0.6.12): 5,037 s
* Ruby (1.9.3): 20,315 s
* Python (2.7.3): 27,539 s

This means that standard Python is almost 35% slower than Ruby. Interesting. :)]]></description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>Here are the benchmark on my system:<br />
* nodejs (0.6.12): 5,724 s<br />
* Ruby (1.9.3): 23,085 s<br />
* Python (2.7.3): 31,294 s</p>
<p>If we linearly adjust the above times with a coefficient of &#8220;0,88&#8243; so that they match the already done benchmarks in the blog post, we get the following numbers:<br />
* nodejs (0.6.12): 5,037 s<br />
* Ruby (1.9.3): 20,315 s<br />
* Python (2.7.3): 27,539 s</p>
<p>This means that standard Python is almost 35% slower than Ruby. Interesting. <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Darek (@sevisilex)</title>
		<link>http://blog.famzah.net/2010/07/01/cpp-vs-python-vs-perl-vs-php-performance-benchmark/#comment-4882</link>
		<dc:creator><![CDATA[Darek (@sevisilex)]]></dc:creator>
		<pubDate>Wed, 02 Jan 2013 21:22:39 +0000</pubDate>
		<guid isPermaLink="false">http://blog.famzah.net/?p=732#comment-4882</guid>
		<description><![CDATA[Here code If you need for Ruby, what the time benchmark between nodejs and ruby?

[sourcecode language=&quot;ruby&quot; collapse=&quot;true&quot;]
def get_primes7(n)
	if n &lt; 2
		return []
	end
	
	if n == 2
		return [2]
	end
	
	#s = Range.new(3, n, 2)???
	s = []
	i = 3
	while i &lt; n + 1
		s.push(i)
		i += 2
	end
	
	mroot = Math.sqrt(n)

	half = s.length
	i = 0
	m = 3
	while m &lt;= mroot
		if s[i] != 0
			j = (m * m - 3) / 2
			s[j] = 0
			while j &lt; half
				s[j] = 0
				j += m
			end
		end
		i = i + 1
		m = 2 * i + 3
	end
	
	res = [2]
	for v in s
		if v != 0
			res.push(v);
		end
	end
#	x = 0
#	while x &lt; s.length
#		if s[x] != 0
#			res.push(s[x])
#		end
#		x = x + 1
#	end
	return res
end


res = [];
for i in 1..10
	res = get_primes7 10000000
	puts &quot;Found #{res.length} prime numbers.\n&quot;
end
[/sourcecode]]]></description>
		<content:encoded><![CDATA[<p>Here code If you need for Ruby, what the time benchmark between nodejs and ruby?</p>
<pre class="brush: ruby; collapse: true; light: false; title: ; toolbar: true; notranslate">
def get_primes7(n)
	if n &amp;lt; 2
		return []
	end
	
	if n == 2
		return [2]
	end
	
	#s = Range.new(3, n, 2)???
	s = []
	i = 3
	while i &amp;lt; n + 1
		s.push(i)
		i += 2
	end
	
	mroot = Math.sqrt(n)

	half = s.length
	i = 0
	m = 3
	while m &amp;lt;= mroot
		if s[i] != 0
			j = (m * m - 3) / 2
			s[j] = 0
			while j &amp;lt; half
				s[j] = 0
				j += m
			end
		end
		i = i + 1
		m = 2 * i + 3
	end
	
	res = [2]
	for v in s
		if v != 0
			res.push(v);
		end
	end
#	x = 0
#	while x &amp;lt; s.length
#		if s[x] != 0
#			res.push(s[x])
#		end
#		x = x + 1
#	end
	return res
end


res = [];
for i in 1..10
	res = get_primes7 10000000
	puts &amp;quot;Found #{res.length} prime numbers.\n&amp;quot;
end
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ivan Zahariev</title>
		<link>http://blog.famzah.net/2010/07/01/cpp-vs-python-vs-perl-vs-php-performance-benchmark/#comment-4629</link>
		<dc:creator><![CDATA[Ivan Zahariev]]></dc:creator>
		<pubDate>Wed, 24 Oct 2012 14:17:05 +0000</pubDate>
		<guid isPermaLink="false">http://blog.famzah.net/?p=732#comment-4629</guid>
		<description><![CDATA[Before approving this comment, I wrote to &quot;akesterson&quot; per-email with some questions:

&lt;strong&gt;(begin my questions)&lt;/strong&gt;

Thanks for the comment and benchmark results. Something&#039;s strange about the numbers though -- they show almost nothing for &quot;user&quot; and &quot;sys&quot; times... I also see &quot;gcc.exe&quot; -- did you run the tests on Windows?

Not knowing the real &quot;user&quot; and &quot;sys&quot; values leaves a small backdoor for the JS compiler to use multi-threading which is &quot;unfair competition&quot; here since all tests are strictly single-threaded. Furthermore, you should also provide the source code.

&lt;strong&gt;(end my questions)&lt;/strong&gt;

Here is his very thorough and satisfying reply:

&lt;strong&gt;(begin &quot;akesterson&quot; reply)&lt;/strong&gt;

Thanks for getting back to me!

Yes, I performed the tests on windows using mingw, as pointed out in the first paragraph of the comment (sorry if that wasn&#039;t clear, I really didn&#039;t belabor the point at all).

The user times on windows are confusing, the &quot;real&quot; times in mingw are the only ones that can really be trusted, or which should be considered.

As far as multithreading, SpiderMonkey is absolutely single threaded (see http://blog.mozilla.org/luke/2012/01/24/jsruntime-is-now-officially-single-threaded/ for a brief report of same; I was using the stock js.exe command line, which does not support the W3 web workers stuff).

Regarding the source, I did not change the source at all, except to change the javascript console.log to a print statement. here is the diff:
[sourcecode collapse=&quot;true&quot; language=&quot;text&quot;]
akesterson@andrew-laptop ~/source/unorganized
$ wget -O primes-js.txt.orig http://www.famzah.net/download/langs-performance/primes-js.txt
--2012-10-22 00:19:12--  http://www.famzah.net/download/langs-performance/primes-js.txt
Resolving www.famzah.net (www.famzah.net)... 64.14.78.45
Connecting to www.famzah.net (www.famzah.net)&#124;64.14.78.45&#124;:80... connected.
HTTP request sent, awaiting response... d200 OK
Length: 656 [text/plain]
Saving to: `primes-js.txt.orig&#039;

     0K                                                       100%  476K=0.001s

2012-10-22 00:19:13 (476 KB/s) - `primes-js.txt.orig&#039; saved [656/656]

akesterson@andrew-laptop ~/source/unorganized
$ diff primes-js.txt.orig primes-js.txt
39c39
&lt;       console.log(&quot;Found &quot; + res.length + &quot; prime numbers.&quot;);
---
&gt;       print(&quot;Found &quot; + res.length + &quot; prime numbers.&quot;); 
[/sourcecode]

I hope these explanations are sufficient to clear up any confusion regarding the sanity of my test results. Thanks again.

&lt;strong&gt;(end &quot;akesterson&quot; reply)&lt;/strong&gt;]]></description>
		<content:encoded><![CDATA[<p>Before approving this comment, I wrote to &#8220;akesterson&#8221; per-email with some questions:</p>
<p><strong>(begin my questions)</strong></p>
<p>Thanks for the comment and benchmark results. Something&#8217;s strange about the numbers though &#8212; they show almost nothing for &#8220;user&#8221; and &#8220;sys&#8221; times&#8230; I also see &#8220;gcc.exe&#8221; &#8212; did you run the tests on Windows?</p>
<p>Not knowing the real &#8220;user&#8221; and &#8220;sys&#8221; values leaves a small backdoor for the JS compiler to use multi-threading which is &#8220;unfair competition&#8221; here since all tests are strictly single-threaded. Furthermore, you should also provide the source code.</p>
<p><strong>(end my questions)</strong></p>
<p>Here is his very thorough and satisfying reply:</p>
<p><strong>(begin &#8220;akesterson&#8221; reply)</strong></p>
<p>Thanks for getting back to me!</p>
<p>Yes, I performed the tests on windows using mingw, as pointed out in the first paragraph of the comment (sorry if that wasn&#8217;t clear, I really didn&#8217;t belabor the point at all).</p>
<p>The user times on windows are confusing, the &#8220;real&#8221; times in mingw are the only ones that can really be trusted, or which should be considered.</p>
<p>As far as multithreading, SpiderMonkey is absolutely single threaded (see <a href="http://blog.mozilla.org/luke/2012/01/24/jsruntime-is-now-officially-single-threaded/" rel="nofollow">http://blog.mozilla.org/luke/2012/01/24/jsruntime-is-now-officially-single-threaded/</a> for a brief report of same; I was using the stock js.exe command line, which does not support the W3 web workers stuff).</p>
<p>Regarding the source, I did not change the source at all, except to change the javascript console.log to a print statement. here is the diff:</p>
<pre class="brush: plain; collapse: true; light: false; title: ; toolbar: true; notranslate">
akesterson@andrew-laptop ~/source/unorganized
$ wget -O primes-js.txt.orig <a href="http://www.famzah.net/download/langs-performance/primes-js.txt" rel="nofollow">http://www.famzah.net/download/langs-performance/primes-js.txt</a>
--2012-10-22 00:19:12--  <a href="http://www.famzah.net/download/langs-performance/primes-js.txt" rel="nofollow">http://www.famzah.net/download/langs-performance/primes-js.txt</a>
Resolving <a href="http://www.famzah.net" rel="nofollow">http://www.famzah.net</a> (www.famzah.net)... 64.14.78.45
Connecting to <a href="http://www.famzah.net" rel="nofollow">http://www.famzah.net</a> (www.famzah.net)|64.14.78.45|:80... connected.
HTTP request sent, awaiting response... d200 OK
Length: 656 [text/plain]
Saving to: `primes-js.txt.orig'

     0K                                                       100%  476K=0.001s

2012-10-22 00:19:13 (476 KB/s) - `primes-js.txt.orig' saved [656/656]

akesterson@andrew-laptop ~/source/unorganized
$ diff primes-js.txt.orig primes-js.txt
39c39
&amp;lt;       console.log(&quot;Found &quot; + res.length + &quot; prime numbers.&quot;);
---
&amp;gt;       print(&quot;Found &quot; + res.length + &quot; prime numbers.&quot;); 
</pre>
<p>I hope these explanations are sufficient to clear up any confusion regarding the sanity of my test results. Thanks again.</p>
<p><strong>(end &#8220;akesterson&#8221; reply)</strong></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: akesterson</title>
		<link>http://blog.famzah.net/2010/07/01/cpp-vs-python-vs-perl-vs-php-performance-benchmark/#comment-4607</link>
		<dc:creator><![CDATA[akesterson]]></dc:creator>
		<pubDate>Mon, 22 Oct 2012 01:48:05 +0000</pubDate>
		<guid isPermaLink="false">http://blog.famzah.net/?p=732#comment-4607</guid>
		<description><![CDATA[Here is a version of the JavaScript benchmark, but on SpiderMonkey (the Firefox javascript engine), executed using the spidermonkey &#039;js&#039; command line. I included comparisons against mingw C++ and win64 Python2.7 for context.

--------------------

akesterson@andrew-laptop ~/source
$ bash bench.sh
== C++ (optimized with -O2) ==

real    0m2.141s
user    0m0.015s
sys     0m0.015s

real    0m2.163s
user    0m0.047s
sys     0m0.000s

g++.exe (GCC) 4.5.2

== C++ (not optimized) ==

real    0m5.032s
user    0m0.000s
sys     0m0.000s

real    0m5.390s
user    0m0.031s
sys     0m0.000s

g++.exe (GCC) 4.5.2

== Python 2.7 ==

real    0m41.942s
user    0m0.031s
sys     0m0.000s

real    0m42.127s
user    0m0.015s
sys     0m0.031s

Python 2.7.2

== JavaScript (SpiderMonkey) ==

real    0m5.022s
user    0m0.015s
sys     0m0.031s

real    0m4.759s
user    0m0.000s
sys     0m0.015s

JavaScript-C 1.8.5+ 2011-04-16

---------------

While this initially suggests that SpiderMonkey is only ~20% slower than V8/Node.js, this can be misleading. My C++ benchmarks are ~30% slower than yours with the same code and compiler (g++ 4.5.2), so it is probably safe to say that the performance of SpiderMonkey is similarly out of context. Adjusting the SpiderMonkey performance by -30%, we get an (average) real runtime of 6.357s, or ~40% slower than Node.js running under V8.

... But still faster than the other &quot;made for serious work&quot; scripting languages, by an astonishingly large margin.]]></description>
		<content:encoded><![CDATA[<p>Here is a version of the JavaScript benchmark, but on SpiderMonkey (the Firefox javascript engine), executed using the spidermonkey &#8216;js&#8217; command line. I included comparisons against mingw C++ and win64 Python2.7 for context.</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>akesterson@andrew-laptop ~/source<br />
$ bash bench.sh<br />
== C++ (optimized with -O2) ==</p>
<p>real    0m2.141s<br />
user    0m0.015s<br />
sys     0m0.015s</p>
<p>real    0m2.163s<br />
user    0m0.047s<br />
sys     0m0.000s</p>
<p>g++.exe (GCC) 4.5.2</p>
<p>== C++ (not optimized) ==</p>
<p>real    0m5.032s<br />
user    0m0.000s<br />
sys     0m0.000s</p>
<p>real    0m5.390s<br />
user    0m0.031s<br />
sys     0m0.000s</p>
<p>g++.exe (GCC) 4.5.2</p>
<p>== Python 2.7 ==</p>
<p>real    0m41.942s<br />
user    0m0.031s<br />
sys     0m0.000s</p>
<p>real    0m42.127s<br />
user    0m0.015s<br />
sys     0m0.031s</p>
<p>Python 2.7.2</p>
<p>== JavaScript (SpiderMonkey) ==</p>
<p>real    0m5.022s<br />
user    0m0.015s<br />
sys     0m0.031s</p>
<p>real    0m4.759s<br />
user    0m0.000s<br />
sys     0m0.015s</p>
<p>JavaScript-C 1.8.5+ 2011-04-16</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>While this initially suggests that SpiderMonkey is only ~20% slower than V8/Node.js, this can be misleading. My C++ benchmarks are ~30% slower than yours with the same code and compiler (g++ 4.5.2), so it is probably safe to say that the performance of SpiderMonkey is similarly out of context. Adjusting the SpiderMonkey performance by -30%, we get an (average) real runtime of 6.357s, or ~40% slower than Node.js running under V8.</p>
<p>&#8230; But still faster than the other &#8220;made for serious work&#8221; scripting languages, by an astonishingly large margin.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ivan Zahariev</title>
		<link>http://blog.famzah.net/2010/07/01/cpp-vs-python-vs-perl-vs-php-performance-benchmark/#comment-4453</link>
		<dc:creator><![CDATA[Ivan Zahariev]]></dc:creator>
		<pubDate>Sun, 23 Sep 2012 07:41:02 +0000</pubDate>
		<guid isPermaLink="false">http://blog.famzah.net/?p=732#comment-4453</guid>
		<description><![CDATA[Hi, as far as I could understand, there is no AS3 compiler in Ubuntu packages and &lt;a href=&quot;http://stackoverflow.com/questions/9792103/compiler-for-actionscript-3-on-linux&quot; rel=&quot;nofollow&quot;&gt;getting&lt;/a&gt; one isn&#039;t exactly trivial. I&#039;ll appreciate it if you run a few of the benchmarks on your system (for example the C++ ones), then your AS3 ones and share the results here.]]></description>
		<content:encoded><![CDATA[<p>Hi, as far as I could understand, there is no AS3 compiler in Ubuntu packages and <a href="http://stackoverflow.com/questions/9792103/compiler-for-actionscript-3-on-linux" rel="nofollow">getting</a> one isn&#8217;t exactly trivial. I&#8217;ll appreciate it if you run a few of the benchmarks on your system (for example the C++ ones), then your AS3 ones and share the results here.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Raphaël</title>
		<link>http://blog.famzah.net/2010/07/01/cpp-vs-python-vs-perl-vs-php-performance-benchmark/#comment-4441</link>
		<dc:creator><![CDATA[Raphaël]]></dc:creator>
		<pubDate>Tue, 18 Sep 2012 11:19:53 +0000</pubDate>
		<guid isPermaLink="false">http://blog.famzah.net/?p=732#comment-4441</guid>
		<description><![CDATA[Hi, I made a port of the bench in AS3, please try it out on your test system.

[sourcecode language=&quot;javascript&quot; collapse=&quot;true&quot;]
package 
{
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.text.TextField;
	import flash.utils.getTimer;
	
	/**
	 * ...
	 * @author Raphaël Benzazon
	 */
	public class Main extends Sprite 
	{
		
		public function Main():void 
		{
			if (stage) init();
			else addEventListener(Event.ADDED_TO_STAGE, init);
		}
		
		private function init(e:Event = null):void 
		{
			removeEventListener(Event.ADDED_TO_STAGE, init);
			// entry point
			var timeBefore:int = getTimer();
			for (var i:int = 0; i &lt; 10; i++) {
				var res:Vector = get_primes7(10000000);				
			}			
			
			trace(&quot;Found &quot; + res.length + &quot; prime numbers.&quot;);
				
			var timeAfter:int = getTimer()-timeBefore;
			var text:TextField = new TextField();
			addChild(text);
			text.text = String(timeAfter);
		}
		private function get_primes7(n:int):Vector {
			var res:Vector;
			var lnt:int;
			if (n &lt; 2) { return new Vector(); }
			if (n == 2) {
				res = new Vector();
				res.push(2)
				return res;
			}
			var j:int;
			var s:Vector = new Vector();
			lnt = n + 1;
			for (var i:int = 3; i &lt; lnt; i += 2) {
				s.push(i);
			}

			var mroot:int = int(Math.sqrt(n));
			var half:int = s.length;
			i = 0;
			var m:int = 3;

			while (m &lt;= mroot) {
				if (s[i]) {
					j = (m*m-3)/2;   // int div
					s[j] = 0;
					while (j &lt; half) {
						s[j] = 0;
						j += m;
					}
				}
				i++;
				m = 2*i + 3;
			}

			res = new Vector();
			res.push(2);
			lnt = s.length;
			for (var x:int = 0; x &lt; lnt; x++) {
				if (s[x]) {
					res.push(s[x]);
				}
			}
			return res;
		}


		
	}
	
}
[/sourcecode]]]></description>
		<content:encoded><![CDATA[<p>Hi, I made a port of the bench in AS3, please try it out on your test system.</p>
<pre class="brush: jscript; collapse: true; light: false; title: ; toolbar: true; notranslate">
package 
{
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.text.TextField;
	import flash.utils.getTimer;
	
	/**
	 * ...
	 * @author Raphaël Benzazon
	 */
	public class Main extends Sprite 
	{
		
		public function Main():void 
		{
			if (stage) init();
			else addEventListener(Event.ADDED_TO_STAGE, init);
		}
		
		private function init(e:Event = null):void 
		{
			removeEventListener(Event.ADDED_TO_STAGE, init);
			// entry point
			var timeBefore:int = getTimer();
			for (var i:int = 0; i &lt; 10; i++) {
				var res:Vector = get_primes7(10000000);				
			}			
			
			trace(&quot;Found &quot; + res.length + &quot; prime numbers.&quot;);
				
			var timeAfter:int = getTimer()-timeBefore;
			var text:TextField = new TextField();
			addChild(text);
			text.text = String(timeAfter);
		}
		private function get_primes7(n:int):Vector {
			var res:Vector;
			var lnt:int;
			if (n &lt; 2) { return new Vector(); }
			if (n == 2) {
				res = new Vector();
				res.push(2)
				return res;
			}
			var j:int;
			var s:Vector = new Vector();
			lnt = n + 1;
			for (var i:int = 3; i &lt; lnt; i += 2) {
				s.push(i);
			}

			var mroot:int = int(Math.sqrt(n));
			var half:int = s.length;
			i = 0;
			var m:int = 3;

			while (m &lt;= mroot) {
				if (s[i]) {
					j = (m*m-3)/2;   // int div
					s[j] = 0;
					while (j &lt; half) {
						s[j] = 0;
						j += m;
					}
				}
				i++;
				m = 2*i + 3;
			}

			res = new Vector();
			res.push(2);
			lnt = s.length;
			for (var x:int = 0; x &lt; lnt; x++) {
				if (s[x]) {
					res.push(s[x]);
				}
			}
			return res;
		}


		
	}
	
}
</pre>
]]></content:encoded>
	</item>
</channel>
</rss>
