Giter Site home page Giter Site logo

firevenus / comparison-programming-languages-economics Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jesusfv/comparison-programming-languages-economics

0.0 3.0 0.0 362 KB

A Comparison of Programming Languages in Economics

License: MIT License

C++ 17.73% C 16.00% C# 5.70% Fortran 5.22% JavaScript 5.88% HTML 0.13% Java 7.12% Julia 3.40% Mathematica 11.12% MATLAB 6.58% Python 12.23% R 8.89%

comparison-programming-languages-economics's Introduction

Comparison of Programming Languages in Economics

This project contains the source code referenced in the paper A Comparison of Programming Languages in Economics by S. Borağan Aruoba and Jesús Fernández-Villaverde.

The main fork will remain basically unchanged to allow researchers to check our basic results.

Abstract from the paper

We solve the stochastic neoclassical growth model, the workhorse of modern macroeconomics, using C++11, Fortran 2008, Java, Julia, Python, Matlab, Mathematica, and R. We implement the same algorithm, value function iteration with grid search, in each of the languages. We report the execution times of the codes in a Mac and in a Windows computer and comment on the strength and weakness of each language.

Files

  1. RBC_C.c: C code.
  2. RBC_CPP.cpp: C++ code
  3. RBC_CPP_2.cpp: C++ code, more idiomatic but slightly slower.
  4. RBC_F90.f90: Fortran code.
  5. RBC_Java.java: Java code.
  6. RBC_Julia.jl: Julia code, to run RBC_Julia; @time main().
  7. RBC_Matlab.m: Matlab code.
  8. RBC_Matlab_Inside_Loop.m: Matlab code with Mex file.
  9. inside_loop_mex.cpp: Mex file for 8.
  10. RBC_Python.py: Python code for CPython and Pypy.
  11. RBC_Python_Numba.py: Python code for Numba.
  12. RBC_R.R: R code.
  13. RBC_R_Compiler.R: R code compiled.
  14. RBC_Rcpp.R: R code with Rcpp.
  15. InsideLoop.cpp: C++ function for Rcpp.
  16. RBC_Mathematica: Mathematica code.
  17. RBC_Mathematica_Imperative: Mathematica code with imperative structure.
  18. RBC_Mathematica_PartialCompilation: Mathematica code with imperative structure and partial compilation.
  19. RBC_CS.cs: C# code.
  20. 'RBC_JS.js': Javascrip code.
  21. 'RBC_Python_Cython.py': Cython code.

Compilation flags

  1. GCC compiler (Mac): g++ -o testc -O3 RBC_CPP.cpp
  2. GCC compiler (Windows): g++ -Wl,--stack,4000000, -o testc -O3 RBC_CPP.cpp
  3. GCC compiler (Mac): g++ -o testc -O3 -std=gnu++11 RBC_CPP_2.cpp
  4. Clang compiler: clang++ -o testclang -O3 RBC_CPP.cpp
  5. Intel compiler: icpc -o testc -O3 RBC_CPP.cpp
  6. Visual C: cl /F 4000000 /o testvcpp /O2 RBC_CPP.cpp
  7. GCC compiler: gfortran -o testf -O3 RBC_F90.f90
  8. Intel compiler: ifortran -o testf -O3 RBC_F90.f90
  9. javac RBC_Java.java and run as java RBC_Java -XX:+AggressiveOpts
  10. RBC_C.c can be compiled in C, C++ and Objective-C: clang -o testc -x <language> -O3 RBC_C.c with <language> = c, c++ or objective-c. Same for GCC.

In all cases with a JIT, you may want to warm up the JIT before testing for speed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.