From: Enrico Tassi Date: Wed, 5 Apr 2006 13:23:39 +0000 (+0000) Subject: added estimate_size X-Git-Tag: make_still_working~7432 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=cfea6dbbb5f488f85e4cd7069d5c9179a2ed0b2d;hp=523e56972ba1270d53b9d209e2de4e986c77992b;p=helm.git added estimate_size --- diff --git a/helm/software/components/extlib/hExtlib.ml b/helm/software/components/extlib/hExtlib.ml index 8a0c8cf7d..bf725122c 100644 --- a/helm/software/components/extlib/hExtlib.ml +++ b/helm/software/components/extlib/hExtlib.ml @@ -365,3 +365,7 @@ let raise_localized_exception ~offset floc exn = { flocb with Lexing.pos_cnum = x }, { floce with Lexing.pos_cnum = y } in raise (Localized (floc, exn)) + +let estimate_size x = + 4 * (String.length (Marshal.to_string x [])) / 1024 + diff --git a/helm/software/components/extlib/hExtlib.mli b/helm/software/components/extlib/hExtlib.mli index c41b2f94c..37a3bc6df 100644 --- a/helm/software/components/extlib/hExtlib.mli +++ b/helm/software/components/extlib/hExtlib.mli @@ -94,3 +94,7 @@ val floc_of_loc: int * int -> Token.flocation val dummy_floc: Lexing.position * Lexing.position val raise_localized_exception: offset:int -> Token.flocation -> exn -> 'a + +(* size in KB (SLOW) *) +val estimate_size: 'a -> int +