While looking for different benchmarks I’ve found It’s supposed to be faster 
than Julia for many operations, though it doesn’t have so many libraries:

[https://gist.github.com/sdwfrost/7c660322c6c33961297a826df4cbc30d](https://gist.github.com/sdwfrost/7c660322c6c33961297a826df4cbc30d)

julia_nim_cpp_r_sir.md This gist compares the performance of Julia, Nim, C++ 
and R - the latter using either 
[POMP]([http://kingaa.github.io/pomp/)](http://kingaa.github.io/pomp/\)), or 
[LibBi]([http://libbi.org/](http://libbi.org/)) in a simple simulation of an 
[SIR]([https://en.wikipedia.org/wiki/Compartmental_models_in_epidemiology#The_SIR_model](https://en.wikipedia.org/wiki/Compartmental_models_in_epidemiology#The_SIR_model))
 epidemiological model. In addition to keeping track of susceptibles, infecteds 
and recovereds, I also store the cumulative number of infections. Time moves in 
discrete steps, and the algorithm avoids language-specific syntax features to 
make the comparison as fair as possible, including using the same algorithm for 
generating binomial random numbers and the same random number generator; the 
exception are the R versions, POMP uses the standard R Mersenne Twister for the 
random number generator; I'm not sure what LibBi uses. The algorithm for 
generating random binomial numbers is only really suitable for small np.

Benchmarks were run on a Mac Pro (Late 2013), with 3 Ghz 8-core Intel Xeon E3, 
64GB 1866 Mhz RAM, running OSX v 10.11.3 (El Capitan), using Julia v0.6.1, Nim 
v0.17.3, clang v5.0.0, emscripten v1.37.34, node v8.9.1, and R v3.3.2.

## Nim version

### Native

Compile using: This file has been truncated. show original nim.cfg

@if asmjs or wasm:
    d:emscripten

@end

@if emscripten or asmjs or wasm:
    o:"index.html"

@if not wasm:
    d:asmjs

@end

This file has been truncated. show original sir.cpp #include <array> #include 
<vector> #include <cmath> #include <iostream> #include <climits> #include 
<limits> #include <iterator> #include <numeric> #include <chrono> This file has 
been truncated. show original There are more than three files. show original

Reply via email to