Version française
Home     About     Download     Resources     Contact us    
Browse thread
Optimizing garbage collection
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Eray Ozkural <examachine@g...>
Subject: Optimizing garbage collection
A program I wrote constructs a lot of small lists, and strings and discards
them. It's a search algorithm. I profiled this code and saw that garbage
collection takes significant time.

In C++, we can write custom allocators to optimize the data structures that
cause such slowdowns. Any recommended strategies in ocaml?

Best,

Call graph in gprof output on linux:

granularity: each sample hit covers 2 byte(s) for 0.00% of 8680.47 seconds

index % time    self  children    called     name
                0.00    1.31    3777/13406323     caml_alloc [139]
                0.00    2.45    7076/13406323     caml_alloc_small [94]
                0.00    6.42   18532/13406323     caml_copy_double [119]
                0.05  405.30 1169992/13406323     caml_alloc_string [16]
                0.10  721.02 2081381/13406323     caml_check_urgent_gc [27]
                0.48 3507.65 10125565/13406323     caml_garbage_collection
[3]
[1]     53.5    0.63 4644.15 13406323         caml_minor_collection [1]
                2.13 2625.29 13406323/13406323
caml_major_collection_slice [5]
                2.25 2014.36 26812646/26812646     caml_empty_minor_heap [6]
                0.13    0.00 13406323/13406323     caml_final_do_calls [308]
-----------------------------------------------
                                                 <spontaneous>
[2]     40.4    0.66 3508.19                 caml_call_gc [2]
                0.03 3508.16 10125565/10125565     caml_garbage_collection
[3]
-----------------------------------------------
                0.03 3508.16 10125565/10125565     caml_call_gc [2]
[3]     40.4    0.03 3508.16 10125565         caml_garbage_collection [3]
                0.48 3507.65 10125565/13406323     caml_minor_collection [1]
                0.03    0.00 10125565/10125627
caml_process_pending_signals [429]
-----------------------------------------------

-- 
Eray Ozkural, PhD candidate.  Comp. Sci. Dept., Bilkent University, Ankara
http://groups.yahoo.com/group/ai-philosophy
http://myspace.com/arizanesil http://myspace.com/malfunct