Spidermonkey (91), QuickJS (2021-03-27)
Intel MacOS SM91
% ./configure --dev --spidermonkey-version 91 && make
% TIMEFMT=$'Total (sec): \t%*E\nMax RSS(kb): \t%M\n'
% time ./couchjs
-module(statbench). | |
-export([ | |
go_counter/2, | |
go_gauge/2, | |
go_hist/2 | |
]). | |
go_counter(N, X) -> | |
go(N, X, fun upstat_counter/1). |
-module(ringbench). | |
-export([go/2]). | |
go(M, N) when is_integer(M), M > 1, is_integer(N), N > 1 -> | |
io:format("~p processes, ~p messages~n", [N, M]), | |
T = erlang:monotonic_time(), | |
{FirstPid, FirstRef} = spawn_monitor(fun() -> first() end), | |
LastPid = lists:foldl(fun(_, Pid) -> spawn_link(fun() -> loop(Pid) end) end, FirstPid, lists:seq(2, N)), | |
io:format("processes spawned in ~p usec~n", [dt(T)]), |
-module(estone). | |
% Copied form OTP erts/emulator/test/estone_SUITE.erl | |
% run with estone:estone(). May take a few minutes to run. | |
% | |
-export([estone/0]). | |
%% Internal exports for EStone tests | |
-export([ |
-module(fbench). | |
% fbench:bench(). | |
% * created db fbench-1683604564287312344 [{q,64},{n,3}] in 17869 usec | |
% * put 200 docs with 2823 usec per op | |
% * get doc 20000X with 1157 usec per op | |
% * get security 20000X with 225 usec per op | |
% ok | |
-export([ |
%> filebench:all("...data.../filebench.couch"). | |
% * bsize: 65536 pread: 11 couch_file pread: 74 write: 465 couch_file append_bin: 477 | |
% * bsize: 16384 pread: 8 couch_file pread: 49 write: 218 couch_file append_bin: 277 | |
% * bsize: 4096 pread: 9 couch_file pread: 41 write: 197 couch_file append_bin: 236 | |
% * bsize: 1024 pread: 11 couch_file pread: 37 write: 183 couch_file append_bin: 222 | |
% | |
-module(filebench). |
% | |
% $ erl -name [email protected] | |
% | |
% $ erl -name [email protected] | |
% ([email protected])2> dist_perf:go('[email protected]'). | |
-module(distbench). | |
-export([go/1, go/2, go/3, stop/0, gc/0, stats/1]). |
% | |
% Run on Erlang 24+ | |
% | |
% (MFatags true is to enable instrumentation for fix_alloc) | |
% | |
% $ erl -name [email protected] +MFatags true | |
% ([email protected])> | |
% | |
% $ erl -name [email protected] +MFatags true | |
% ([email protected])2> c(fixalloc), fixalloc:go('[email protected]'). |
Spidermonkey (91), QuickJS (2021-03-27)
Intel MacOS SM91
% ./configure --dev --spidermonkey-version 91 && make
% TIMEFMT=$'Total (sec): \t%*E\nMax RSS(kb): \t%M\n'
% time ./couchjs
xref:stop(s). | |
xref:start(s). | |
xref:set_default(s, [{verbose, false}, {warnings, false}]). | |
xref:add_release(s, "./src"). | |
xref:add_release(s, code:lib_dir(), {name, otp}). | |
f(). | |
IgnorePrefixes = [ | |
"hipe", "ibrowse", "hyper", "meck", "metrics", "parse_trans", "eunit_test", "hackney", |
1> application:start(luerl), | |
1> F1 = "function(doc) emit('key1', doc) \n emit('key2', 'val2') end", | |
1> F2 = "function(doc) emit('key3', 'val3') end", | |
1> S0 = luerl_sandbox:init(), | |
1> {_, S1} = luerl:do("emits = {} \n function emit(k, v) \n table.insert(emits, {k, v}) end", S0), | |
1> {ok, C1, S2} = luerl:load("f = " ++ F1 ++ " \n f(...) \n return emits", S1), | |
1> {ok, C2, S3} = luerl:load("f = " ++ F2 ++ " \n f(...) \n return emits", S2), | |
1> {R1, _} = luerl:call_chunk(C1, [#{<<"_id">> => <<"1">>, <<"a">> => <<"b">>}], S3), | |
1> {R2, _} = luerl:call_chunk(C2, [#{<<"_id">> => <<"1">>, <<"a">> => <<"b">>}], S3), | |
1> #{<<"r1">> => R1, <<"r2">> => R2}. |