Featured Articles

5th Generation Broadwell 14nm family comes in three lines

5th Generation Broadwell 14nm family comes in three lines

Intel's 5th Core processor family, codenamed Broadwell, will launch in three lines for the mobile segment. We are talking about upcoming…

More...
Broadwell Chromebooks coming in late Q1 2015

Broadwell Chromebooks coming in late Q1 2015

Google's Chromebook OS should be updating automatically every six weeks, but Intel doesn't come close with its hardware refresh schedule.

More...
New round of Nexus phone rumour kicks off

New round of Nexus phone rumour kicks off

Rumours involving upcoming Nexus devices are nothing uncommon, but this year there is a fair bit of confusion, especially on the…

More...
Nvidia officially launches the 8-inch Shield Tablet

Nvidia officially launches the 8-inch Shield Tablet

As expected and reported earlier, Nvidia has now officially announced its newest Shield device, the new 8-inch Shield Tablet. While the…

More...
Aerocool Dead Silence reviewed

Aerocool Dead Silence reviewed

Aerocool is well known for its gamer cases with aggressive styling. However, the Dead Silence chassis offers consumers a new choice,…

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