From: Enrico Tassi Date: Wed, 5 Apr 2006 13:23:39 +0000 (+0000) Subject: added estimate_size X-Git-Tag: 0.4.95@7852~1530 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=d2eaaa0e1793c75c56f6fbfbdcf8b8aaa1dc47cb;p=helm.git added estimate_size --- diff --git a/components/extlib/hExtlib.ml b/components/extlib/hExtlib.ml index 8a0c8cf7d..bf725122c 100644 --- a/components/extlib/hExtlib.ml +++ b/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/components/extlib/hExtlib.mli b/components/extlib/hExtlib.mli index c41b2f94c..37a3bc6df 100644 --- a/components/extlib/hExtlib.mli +++ b/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 +