From: <Ala...@en...> - 2003-05-23 06:16:27
|
On Thu, 22 May 2003, Brian Hurt wrote: > On Thu, 22 May 2003, Brian Hurt wrote: > > > Optimization question for the list at large: would doing: > > > > let Int.compare (x : int) (y : int) : int = Pervasives.compare x y > > > > be enough to allow the optimizer to do it's thing? > > > > Answering my own question: looks like no. No for the current OCaml release, yes for the next one... Xavier implemented strength reduction for Pervasives.compare (which means it will be specialized for all integers types, floats, strings). See: http://camlcvs.inria.fr/cgi-bin/cvsweb.cgi/ocaml/bytecomp/translcore.ml.diff?r1=1.87&r2=1.88&f=h http://camlcvs.inria.fr/cgi-bin/cvsweb.cgi/ocaml/byterun/ints.c.diff?r1=1.38&r2=1.39&f=h Objective Caml version 3.06+34 (2003-05-21) # let f (x:int) y = compare x y;; closure L1, 0 push acc 0 push const "f" push getglobal Toploop! getfield 1 appterm 2, 4 restart L1: grab 1 acc 1 push acc 1 ccall int_compare, 2 return 2 -- Alain |