Hi David,
I am trying to create something like Hans Boehm's GC benchmark - http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_bench.html in SML. My current attempt is at: http://pastebin.com/2RW9jpCJ
Sorry - I forgot all my ML years ago. Here are some things I'm not sure how to do nicely in Poly/ML:
* printf without lots of String.concat * is there a runtime API call to get the totalMem (current heap size?) and the free mem (currently unused blocks in heap?) * Are all my ephemeral objects being created properly, or is the compiler optimizing away their allocation? How could I tell? * So far, I have been checking gc activity with --debug gc flag. Are there any more powerful tools for GC profiling/checking?
Thanks, Jeremy
The University of Glasgow, charity number SC004401
On 26/04/12 17:06, Jeremy Singer wrote:
- printf without lots of String.concat
Quick answer to this one: instead of print (String.concat strs) do List.app print strs
Here the text is just kept as a list of strings but, in general, one can build up any abstract text representation to suit a particular need. For example, I use the following interface for horizontal text:
signature H_TEXT_TREE = sig type t
(* Constructors *) val empty : t val sp : int -> t val str : string -> t val chr : char -> t val seq : t list -> t
(* Derived constructors *) val concat : string list -> t
(* Predicates *) val isEmpty : t -> bool
(* Operations *) val size : t -> int val app : (string -> unit) -> t -> unit val toStrings : t -> string list end
Phil
Hi Jeremy,
There are several non-standard functions that may help.
On 26/04/2012 17:06, Jeremy Singer wrote:
Hi David,
I am trying to create something like Hans Boehm's GC benchmark - http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_bench.html in SML. My current attempt is at: http://pastebin.com/2RW9jpCJ
Sorry - I forgot all my ML years ago. Here are some things I'm not sure how to do nicely in Poly/ML:
- printf without lots of String.concat
I don't know about that. Does anyone else have any ideas?
- is there a runtime API call to get the totalMem (current heap
size?) and the free mem (currently unused blocks in heap?)
Poly/ML in SVN has a facility to get quite a lot of internal statistics. Use PolyML.Statistics.getLocalStats to get statistics for the current process or PolyML.Statistics.getRemoteStats to get statistics for another Poly/ML by pid. Note: it seems that this structure is only included if you rebuild the compiler with "make compiler" after "make".
- Are all my ephemeral objects being created properly, or is the
compiler optimizing away their allocation? How could I tell? * So far, I have been checking gc activity with --debug gc flag. Are there any more powerful tools for GC profiling/checking?
PolyML.objSize will show the number of words being used by a data structure. Be careful that if you have any function closures in the data structure it can include everything reachable from the function which could be more than you expect.
One further complication: as part of the great Poly/ML storage management rebuild in SVN there's now a pass that tries to merge identical immutable data structures to reduce the live data size; like PolyML.shareCommonData but only on a single element per pass. It's not enabled by default because it's expensive in CPU time, currently it requires --gcshare 1, but the idea is to enable it when memory is short.
Regards, David
Jeremy> * printf without lots of String.concat
David> I don't know about that. Does anyone else have any ideas?
On Thu, 26 Apr 2012, Jeremy Singer wrote:
I am trying to create something like Hans Boehm's GC benchmark - http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_bench.html
The web page says:
The benchmark should run in roughly 32MB or less on most systems, and some systems run it in about half that.
To get meaningful numbers on current hardware, you should try to drive it to 32GB. This is where things are getting interesting -- it is also about the limit of what the fine Poly/ML 5.4.1 by David can handle comfortable so far, say in really big Isabelle applications.
Old SML/NJ is loosing the game long before 100 MB total heap size, resulting in a factor 10..100 performance loss due to memory menagement, compared to Poly/ML.
I've also seen the JVM getting awkward at 1..2 GB heap size.
Makarius