Caml Weekly News
[Posted February 18, 2003 by cook]
| From: |
| Alan Schmitt <alan.schmitt@polytechnique.org> |
| To: |
| lwn@lwn.net |
| Subject: |
| Attn: Development Editor, Latest Caml Weekly New |
| Date: |
| Tue, 18 Feb 2003 06:08:21 -0500 |
Hello,
Here is the latest Caml Weekly News, week 11 to 18 February, 2003.
1) CamlAgent 0.1
2) Optimizing false polymorphic local functions
3) Any idea about Ocaml 3.07 release date?
======================================================================
1) CamlAgent 0.1
----------------------------------------------------------------------
SooHyoung Oh announced:
CamlAgent version 0.1
- Ocaml applications for Microsoft Agent: http://www.microsoft.com/msagent
- You can see parallel and sequential agent play.
- Home: http://www.taglib.co.kr/ocaml/camlAgent.html
Requirements:
* MS agent characters
- In download page, you can find
= MS Agent core components
= MS Agent character files: Genie, Merlin, Peedy, Robby
* MS Visual C++ Compiler / MS Visual Studio
- I tested on MS Visual Studio .Net.
* Ocaml 3.06
* Lablgtk 1.2.5 - you can source and binary in
http://wwwfun.kurims.kyoto-u.ac.jp/soft/olabl/lablgtk.html
* camlidl 1.04
* camlidl 1.04 patch - I made some patches for MS agent ONLY.
Demos:
- move: moveSquare, moveCircle
- hello: parallel, sequential play
======================================================================
2) Optimizing false polymorphic local functions
----------------------------------------------------------------------
Pascal Zimmer asked and Xavier Leroy answered:
> The other day, I ran into a significant speedup improvement.
> Here is a simpler (and artificial) version:
>
> let min_list l =
> let rec loop mini = function
> [] -> mini
> | (x::r) -> loop (if x <= mini then x else mini) r
> in loop max_int l;;
>
> This function computes the minimal element of an int list. Note however
> that the inner local function "loop" is polymorphic.
>
> Now consider the slightly different version where "loop" is forced into
> a monomorphic function:
>
> let min_list l =
> let rec loop (mini:int) = function
> [] -> mini
> | (x::r) -> loop (if x <= mini then x else mini) r
> in loop max_int l;;
>
> On my computer in native code, the speedup is really significant: more
> than 6 times faster (OK this example was built on purpose...). The
> reason is that in the first case, the operator <= is replaced by a call
> to the internal polymorphic compare_val function, whereas is the second
> case a direct comparison between integers is performed.
> Note also that if you replace the "if" statement by "min x mini", you
> don't get any speedup because the polymorphic function "min" is called
> in any case.
>
> I suspect there are other cases in which the compiler can produce a
> better code when it knows more precisely the types involved.
Yes: besides comparisons, array and bigarray accesses can be compiled
more efficiently if the exact types of the data are known statically.
> So my question is: would it be possible to help him in this way by
> enforcing the type checker to infer a monomorphic type in such
> situations ? By "such situations", I mean: local polymorphic
> functions that are used in exactly one monomorphic setting
> afterwards. Of course, this is not desirable for global functions,
> since it may break the calculus; but for local functions, it should
> be of no harm since we know all the places where they are used, and
> it would not change the type of the wrapper, thus being transparent
> for the user...
> Any comment ?
The following paper formalizes exactly this idea, and gives a type
inference algorithm that avoids unecessary polymorphism like you suggest:
http://citeseer.nj.nec.com/bjorner94minimal.html
======================================================================
3) Any idea about Ocaml 3.07 release date?
----------------------------------------------------------------------
Alessandro Baretta wondered and Xavier Leroy answered:
> I am wondering whether the Ocaml team has any idea about the
> next release date. Any ideas?
Certainly not before late April, and hopefully no later than early July.
I can't be any more precise than this at the moment.
======================================================================
Old cwn
----------------------------------------------------------------------
If you happen to miss a cwn, you can send me a message
(alan.schmitt@inria.fr) and I'll mail it to you, or go take a look at
the archive (http://pauillac.inria.fr/~aschmitt/cwn/). If you also wish
to receive it every week by mail, just tell me so.
======================================================================
Alan Schmitt
--
The hacker: someone who figured things out and made something cool happen.
(
Log in to post comments)