open Printf
let measure f =
let t = Unix.gettimeofday () in
let () = f () in
printf "%.4f sec" (Unix.gettimeofday () -. t)
let () =
let gc () = for i = 1 to 10 do Gc.full_major () done in
let a = Array.make 4_000_000 0 in
measure gc;
printf " normal %u (%u)\n%!" (Array.length a) (Gc.stat ()).Gc.live_words;
Obj.set_tag (Obj.repr a) (Obj.no_scan_tag);
measure gc;
printf " no_scan_tag %u (%u)\n%!" (Array.length a) (Gc.stat ()).Gc.live_words;
measure gc;
printf " no array (%u)\n%!" (Gc.stat ()).Gc.live_words;
()