caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Re: compilation
@ 1997-02-19  8:12 Franck Cassez
  0 siblings, 0 replies; 4+ messages in thread
From: Franck Cassez @ 1997-02-19  8:12 UTC (permalink / raw)
  To: Jean-Christophe.Filliatre; +Cc: caml-list

Bonjour Jean-Christophe,

	concernant les evaluations a la compilation,
j'avais pose une question similaire a Pierre Weis 
l'annee derniere (mon but etait
d'``accelerer'' un programme): je pense que l'exemple suivant
peut t'interesser.

A+

Franck.

- Franck.Cassez@univ-brest.fr - Departement d'Informatique  - 
-- Universite de Bretagne Occidentale  6, Avenue Le Gorgeu --
----   BP 809  ----   29285 Brest Cedex  ----   FRANCE   ----
-- tel: (+33) 02 98 01 69 59 -- fax: (+33) 02 98 01 69 56  --

dixit Pierre :
Je m'explique soit la fonction f:

let f a x = if a then (x + 1) else (x - 1);;

alors f true est la fonction x -> if true then (x + 1) else (x - 1) et non
pas la fonction x -> x + 1

On obtient une petite acce'le'ration en e'crivant:

let f a = if a then (fun x -> x + 1) else (fun x -> x - 1);;

car alors f true est (fun x -> x + 1). Cependant cette propagation des
constantes par le compilateur du (me'ta)-langage n'est pas de bonne
me'thodologie (elle n'est pas efficace). Pour beaucoup gagner il faut
re'aliser un ve'ritable compilateur qui analyse les programmes sources
du langage a` compiler et les optimise lui-me^me.







^ permalink raw reply	[flat|nested] 4+ messages in thread
* compilation
@ 1997-02-13 15:24 Jean-Christophe Filliatre
  1997-02-18 15:26 ` compilation David Monniaux
  1997-02-18 16:53 ` compilation Xavier Leroy
  0 siblings, 2 replies; 4+ messages in thread
From: Jean-Christophe Filliatre @ 1997-02-13 15:24 UTC (permalink / raw)
  To: caml-list


[english translation at the end of this mail]

Bonjour,

1. J'aimerai savoir si :

	let b = true
	let f = if b then f1 else f2

   est compilé en f1, c'est-à-dire si la branche d'un "if" est
   directement sélectionnée lorsque le booléen est "true" ou "false"
   (sans l'évaluer, bien sûr ; simplement directement égal à "true" ou
   "false" au moment de la compilation)
   La raison de ma question est que cela permettrait d'avoir des options
   de compilation directement en Caml sans perdre d'efficacité.

2. de la même manière, est-ce que 

	let f = ...
	let f1 = f
	
   est compilé en remplaçant tout appel à f1 par un appel à f ?
   Ma question est, là encore, de savoir si on ne perd pas
   d'efficacité en renommant des fonctions.

Merci.
--Jean-Christophe.
  email: Jean-Christophe.Filliatre@ens-lyon.fr
  WWW  : http://www.ens-lyon.fr/~jcfillia

 
=english=====================================================================

1. I would like to know if

	let b = true
	let f = if b then f1 else f2

is compiled as f1, that is if the branch of an "if" expression is
directly selected when the boolean expression is "true" or "false"
(without performing any computation on it, of course; just directly
equal to the constructor "true" or "false").
The reason of this question is that it would allow compile options in
Caml without any loss of efficiency.

2. the same way, is

	let f = ...
	let f1 = f

compiled by replacing any call to f1 by a call to f ? 
The question is still to known if we don't loose efficiency by
renaming functions.

Thank you,
--Jean-Christophe.






^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1997-02-19  8:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-02-19  8:12 compilation Franck Cassez
  -- strict thread matches above, loose matches on Subject: below --
1997-02-13 15:24 compilation Jean-Christophe Filliatre
1997-02-18 15:26 ` compilation David Monniaux
1997-02-18 16:53 ` compilation Xavier Leroy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).