Core dump using HiPE (possibly my fault ;-))
Thierry Mallard
thierry@REDACTED
Wed Feb 5 23:27:08 CET 2003
Greetings,
Vlad Dumitrescu helped me optimize a quick bench about computing some
numbers. You'll find the corresponding source attached to this mail.
I got a core dump when trying to run this test using HiPE :
-=-=-=-
[shaman@REDACTED test1]$ erl
Erlang (BEAM) emulator version 5.2 [source] [hipe]
Eshell V5.2 (abort with ^G)
1> c(test1, [native, {hipe, [o3]}]).
{ok,test1}
2> test1:run(10000, 10000).
Generating list of 10000 floats ... <0.36.0>
done
original Test time : 107.411 seconds
3> no next heap size found: 197920092, offset 0
Aborted (core dumped)
-=-=--
The core dump goes away when i change the min_heap_size to 100 000
(instead of 1 000 000), so i'm not sure whereas this is a bug or simply
a bad use of min_heap_size..
Also, the problem stays when i didn't use the o3 flag.
The testing pc is a celeron 400 MHz, 128 MB ram, using Mandrake 9
(gcc 3.2)
Any hints welcome !
Kind regards,
--
Thierry Mallard
http://vawis.net
-------------- next part --------------
%% Erlang implementation of the TEST1 program
%% Many thanks to Luke and Cleverda for helping optimize it :-)
-module(test1).
-export([run/2, run1/2]).
-export([loop/2, loop_1/2]). %% Export mandatory for timer:tc
%% Main function
run( Listsize, Loopcount ) ->
spawn_opt(test1, run1, [Listsize, Loopcount], [{min_heap_size, 1000000},{fullsweep_after, 0}]).
run1(Listsize, Loopcount) ->
Floatlist = generate_list( Listsize ),
erlang:garbage_collect(),
{ Time, Value } = timer:tc( test1, loop, [ Loopcount, Floatlist ] ),
io:format("original Test time : ~p seconds ~n", [ Time / 1.0e6 ]),
erlang:garbage_collect(),
{Time1, Value1 } = timer:tc( test1, loop_1, [ Loopcount, Floatlist ] ),
io:format("improved Test time : ~p seconds ~n", [ Time1 / 1.0e6 ]).
%% Test loop (recursive)
loop( 0, _ ) ->
ok ;
loop(Loopcount, Floatlist ) ->
loop(Loopcount - 1, change_list( Floatlist ) ).
loop_1( 0, _ ) ->
ok ;
loop_1( Loopcount, Floatlist ) ->
loop_1(Loopcount - 1, change_list_1( Floatlist ) ).
%% Change the list (Cleverda version)
change_list([]) -> [];
change_list([F|FloatList]) ->
[F*1.000234 | change_list (FloatList) ].
change_list_1(L) ->
change_list_1(L, []).
change_list_1([], Result) -> lists:reverse(Result);
%%change_list_1([], Result) -> Result;
change_list_1([F|FloatList], Result) ->
change_list_1 (FloatList, [F*1.000234 | Result ]).
%% Generate the list
generate_list( Listsize ) ->
io:format("Generating list of ~p floats ... ", [Listsize] ),
Floatlist = lists:duplicate( Listsize, 1.0 ),
io:format("done~n"),
%% return
Floatlist.
More information about the erlang-questions
mailing list