caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: skaller <skaller@users.sourceforge.net>
To: Brian Hurt <bhurt@spnz.org>
Cc: Markus Mottl <markus@oefai.at>,
	Jean-Marie Gaillourdert <jmg@gaillourdet.net>,
	caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] const equivalent for mutable types?
Date: 01 Aug 2004 03:05:53 +1000	[thread overview]
Message-ID: <1091293552.11540.399.camel@pelican.wigram> (raw)
In-Reply-To: <Pine.LNX.4.44.0407310913240.6739-100000@localhost.localdomain>

On Sun, 2004-08-01 at 00:31, Brian Hurt wrote:

> 
> This way lies hell.

Balance is the key.

I have in fact just converted a functional algorithm
to an imperative one. Its the Felix inliner (which
inlines functions).

What happens is I replace a function call with
the body of the function being called with the
argument replacing the parameter.

The purely functional algorithm was 
inefficient: it has to inline recursively,
and in doing so, it inlines the same function
calls multiple times, because there are multiple
calls. It is faster to 'cache' any inlining done
into a function so when *it* is called the inlined
version can be inlined.

The easiest way to do this caching is simply replace
the function into which inlining is done with the
inlined version :)


-- 
John Skaller, mailto:skaller@users.sf.net
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language http://felix.sf.net



-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


  parent reply	other threads:[~2004-07-31 17:06 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-31  8:56 Christopher A. Gorski
2004-07-31  9:24 ` Jean-Marie Gaillourdert
2004-07-31 10:24   ` Jean-Marie Gaillourdert
2004-07-31 10:50   ` Markus Mottl
2004-07-31 14:31     ` Brian Hurt
2004-07-31 15:51       ` Markus Mottl
2004-07-31 17:05       ` skaller [this message]
2004-07-31 10:34 ` Markus Mottl
2004-07-31 13:44   ` Jon Harrop
2004-07-31 16:31     ` [Caml-list] Phantom types Markus Mottl
2004-08-23  9:49       ` Jon Harrop
2004-08-23 12:25         ` [Caml-list] Why does ocaml use custom buffering? Daan Leijen
2004-08-23 15:16         ` [Caml-list] Phantom types Jon Harrop
2004-08-27  9:03           ` Jacques GARRIGUE
2004-08-25 21:03         ` brogoff
2004-07-31 16:35     ` [Caml-list] const equivalent for mutable types? skaller
2004-07-31 17:23       ` [Caml-list] Functional arrays Jon Harrop
2004-07-31 18:45         ` skaller
2004-08-02  5:07           ` brogoff
2004-08-02  7:45         ` Diego Olivier Fernandez Pons
2004-08-05 16:42           ` Daniel Ortmann
2004-08-05 17:02             ` Diego Olivier Fernandez Pons
2004-08-05 17:16             ` Diego Olivier Fernandez Pons
2004-07-31 17:45   ` [Caml-list] const equivalent for mutable types? Chris Gorski
2004-07-31 14:11 ` Brian Hurt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1091293552.11540.399.camel@pelican.wigram \
    --to=skaller@users.sourceforge.net \
    --cc=bhurt@spnz.org \
    --cc=caml-list@inria.fr \
    --cc=jmg@gaillourdet.net \
    --cc=markus@oefai.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).