caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Goswin von Brederlow <goswin-v-b@web.de>
To: Christoph H??ger <christoph.hoeger@tu-berlin.de>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Compile-time performance problem
Date: Tue, 8 Nov 2016 11:10:16 +0100	[thread overview]
Message-ID: <20161108101015.GC18517@frosties> (raw)
In-Reply-To: <e5ec0d87-28b6-70df-6c3b-46172bff8344@tu-berlin.de>

On Tue, Nov 08, 2016 at 09:56:33AM +0100, Christoph H??ger wrote:
> let (<+) a v = Array.append a [|v|] 
> let foo k s =
>   ((fun k  -> fun s  -> (k#_continue_ (object (self)  end)) 1)
>      (object (self)
>         val _continue_ =
>           fun x  ->
>             (fun k  ->
>                fun s  ->
>                  ((fun k  -> fun s  -> (k#_continue_ (object (self)  end)) 2)
...

Do you have to use objects there? Does the problem go away if you use
a simple type for the continuation?

The thing with CPS is that your code can be converted into simple
jumps instead of function calls. Everything is a tail call. And all
your objects are dummies that can be optimized away if you try hard
enough. Really complex dummies. I can imagine the bytecode simply
creates the objects and calls the methods while the native code
optimizes it all away. Hard to say if that is linear (and really
slow), quadratic or exponential with just one example though.

MfG
	Goswin

  reply	other threads:[~2016-11-08 10:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-07 17:01 Christoph Höger
2016-11-07 17:07 ` Christoph Höger
2016-11-07 17:18   ` Nicolas Ojeda Bar
2016-11-07 17:32     ` Christoph Höger
2016-11-08  8:56       ` Christoph Höger
2016-11-08 10:10         ` Goswin von Brederlow [this message]
2016-11-08 10:49           ` [Caml-list] <SPAM> " Pierre Chambart

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=20161108101015.GC18517@frosties \
    --to=goswin-v-b@web.de \
    --cc=caml-list@inria.fr \
    --cc=christoph.hoeger@tu-berlin.de \
    /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).