Featured Articles

Nvidia GTX 980 reviewed

Nvidia GTX 980 reviewed

Nvidia has released two new graphics cards based on its latest Maxwell GPU architecture. The Geforce GTX 970 and Geforce GTX…

More...
Nvidia adjusts GTX 980 and GTX 970 pricing

Nvidia adjusts GTX 980 and GTX 970 pricing

It appears that Nvidia has been feeling the pulse of the market and took some note from comments regarding the original…

More...
iPhone 6 and 6 Plus reviews are up and they are good

iPhone 6 and 6 Plus reviews are up and they are good

Apple is dancing the same dance year after year. It releases the iPhone and two days before they start shipping it…

More...
Amazon announces three new tablets

Amazon announces three new tablets

Amazon has just released three new tablets starting with the $99 priced 6-inch Kindle Fire HD6. This is a 6-inch tablet…

More...
PowerColor TurboDuo R9 285 reviewed

PowerColor TurboDuo R9 285 reviewed

Today we will take a look at the PowerColor TurboDuo Radeon R9 285. The card is based on AMD’s new…

More...
Frontpage Slideshow | Copyright © 2006-2010 orks, a business unit of Nuevvo Webware Ltd.
Wednesday, 09 July 2014 09:58

Economists should learn C++

Written by Nick Farrell

Stay off the Java

Two economists, S. Boragan Aruoba of the University of Maryland and Jesus Fernandez-Villaverde of the University of Pennsylvania, say that the best programming language for economists is C++. In a National Bureau of Economic Research paper with the catchy title A Comparison of Programming Languages in Economics the pair tested a handful of programming languages commonly used by economists to solve a well-known economic model.

What they thought would be a good test was the problem of stochastic neoclassical growth model. In economics it is not stochastic it is fairly pointless. Using an algorithm which was representative of the computing economists need to do, the pair coded the same problem in three compiled languages (C++, Fortran, Java) using a variety of compilers and five scripting languages (Julia, Python, Matlab, Mathematica, R) and ran the programs on two platforms, Windows and Mac. The languages were then evaluated based on their code execution time.

While Fortran is a popular for economists, it was the C++ that ran the fastest on both Mac and Windows. The elapsed time for C++ compiled with GCC was 0.73 seconds on the Mac, while it was 0.76 seconds for C++ compiled with Visual C++ on Windows. Fortran was a close second on both platforms; execution time on the Mac for Fortran compiled with GCC was 0.76 seconds, while on Windows, it was 0.81 seconds for Intel Fortran. The only other language to come close was Java, which had executions times of 1.95 seconds on Mac and 1.59 seconds on Windows, still twice as slow as C++ and Fortran.

Scripting languages fared worse than compiled languages. Julia did the best, coming in close to Java, about twice as slow as C++. Matlab was about 10-times slower than C++ on both Mac and Windows, while Python code ranged from being about 40-times slower than C++ on both Mac and Windows (for Pypy) to well over 200-times slower (CPython) on the Mac. R ranged from 500 to 700-times slower, while Mathematica did the worst, being 800-times slower than C++ on the Mac.

Boragan Aruoba and Fernandez-Villaverde did not attempt to use special features of each language to optimise the code, instead opting for similar implementations across the languages as a way to control for programmer skill and because it would make comparison difficult.

Nick Farrell

E-mail: This e-mail address is being protected from spambots. You need JavaScript enabled to view it
blog comments powered by Disqus

 

Facebook activity

Latest Commented Articles

Recent Comments