Skip to content

Instantly share code, notes, and snippets.

@krestenkrab
Last active December 22, 2015 03:48
Show Gist options
  • Save krestenkrab/6412202 to your computer and use it in GitHub Desktop.
Save krestenkrab/6412202 to your computer and use it in GitHub Desktop.
Running the nbody problem, Erjang vs. HiPE: 412% speedup
krab$ erl
Erlang R15B03 (erts-5.9.3.1) [source] [64-bit] [smp:4:4] [async-threads:0] [hipe] [kernel-poll:false]
Eshell V5.9.3.1 (abort with ^G)
1> nbody:module_info().
[{exports,[{main,1},{module_info,0},{module_info,1}]},
{imports,[]},
{attributes,[{vsn,[219858955424611931400228266183821808428]}]},
{compile,[{options,[{outdir,"/Users/krab/Projects/erjang/test_server"}]},
{version,"4.8.2"},
{time,{2013,9,2,12,9,51}},
{source,"/Users/krab/Projects/erjang/test_server/nbody.erl"}]}]
2> timer:tc(nbody, main, [ ["5000000"] ]).
-0.169075164
-0.169083134
{29119264,ok}
3> timer:tc(nbody, main, [ ["5000000"] ]).
-0.169075164
-0.169083134
{29420451,ok}
4> timer:tc(nbody, main, [ ["5000000"] ]).
-0.169075164
-0.169083134
{29048581,ok}
krab$ ../ej
** Erjang R15B03 ** [root:/usr/local/lib/erlang] [erts:5.9.3.1] [unicode]
Eshell V5.9.3.1 (abort with ^G)
1> nbody:module_info().
[{exports,[{module_info,0},{main,1},{module_info,1}]},
{attributes,[{vsn,[219858955424611931400228266183821808428]}]},
{compile,[{source,"/Users/krab/Projects/erjang/test_server/nbody.erl"},
{time,{2013,9,2,12,3,23}},
{version,"4.8.2"},
{options,[{outdir,"/Users/krab/Projects/erjang/test_server"},
{hipe,[o3]},
native]}]}]
2> timer:tc(nbody, main, [ ["5000000"] ]).
-0.169075164
-0.169083134
{5393644,ok}
3> timer:tc(nbody, main, [ ["5000000"] ]).
-0.169075164
-0.169083134
{5326804,ok}
4> timer:tc(nbody, main, [ ["5000000"] ]).
-0.169075164
-0.169083134
{5017029,ok}
krab$ erl
Erlang R15B03 (erts-5.9.3.1) [source] [64-bit] [smp:4:4] [async-threads:0] [hipe] [kernel-poll:false]
Eshell V5.9.3.1 (abort with ^G)
1> nbody:module_info().
[{exports,[{main,1},{module_info,0},{module_info,1}]},
{imports,[]},
{attributes,[{vsn,[219858955424611931400228266183821808428]}]},
{compile,[{options,[{outdir,"/Users/krab/Projects/erjang/test_server"},
{hipe,[o3]},
native]},
{version,"4.8.2"},
{time,{2013,9,2,12,3,23}},
{source,"/Users/krab/Projects/erjang/test_server/nbody.erl"}]}]
2> timer:tc(nbody, main, [ ["5000000"] ]).
-0.169075164
-0.169083134
{21289364,ok}
3> timer:tc(nbody, main, [ ["5000000"] ]).
-0.169075164
-0.169083134
{20912921,ok}
4> timer:tc(nbody, main, [ ["5000000"] ]).
-0.169075164
-0.169083134
{20646792,ok}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment