Skip to content

Commit

Permalink
Tweak process/spawn options
Browse files Browse the repository at this point in the history
  • Loading branch information
jesperes committed Jan 31, 2024
1 parent f68d4a5 commit 77ec386
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/erlang_1brc.erl
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,18 @@ start_workers() ->
start_workers(erlang:system_info(logical_processors)).

start_workers(NumProcs) ->
process_flag(message_queue_data, off_heap),
process_flag(priority, high),
Options = [link,
{min_heap_size, 1024*1024},
{min_bin_vheap_size, 1024*1024},
{max_heap_size, (1 bsl 59) -1}
],
Self = self(),
io:format("Starting ~p parallel workers~n", [NumProcs]),
lists:foldl(
fun(_, Pids) ->
[spawn_link(fun() -> worker_loop(Self) end)|Pids]
[spawn_opt(fun() -> worker_loop(Self) end, Options)|Pids]
end, [], lists:seq(1, NumProcs)).

worker_loop(Pid) ->
Expand Down

0 comments on commit 77ec386

Please sign in to comment.