caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Kuba Ober <ober.14@osu.edu>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] ocaml garbage collector_S_
Date: Sun, 22 Feb 2009 16:41:04 -0500	[thread overview]
Message-ID: <17FAD835-1612-4ADA-B6D7-1B84CC52CC38@osu.edu> (raw)
In-Reply-To: <20090222112614.GA14473@philou.ch>

> industrial control process, audio processing share a need for others  
> pattern of allocation, solved using pools
> of memory range of various size.

I think that there is a big class of realtime signal processing where  
dynamic memory allocation is not only uncalled for, but would be a  
performance disaster. A good compiler for OCaml (or any other  
"dynamic" language) should be able to recognize where static  
allocation is applicable. Unfortunately, most compilers do not do  
whole-project compilation, they only deal with one file at a time.  
There is a large class of programs where memory can be completely  
statically allocated, and where you don't even need stack for anything  
but storage of function return addresses.

Some time ago I have done a rather bastardized and godawful Lisp  
compiler for eZ8 and SX microcontrollers, solely for use in realtime  
signal processing. Everything is type-inferred and statical types are  
assigned to all variables; there's no runtime polymorphism (the  
compiler barfs if any type would not be a constant after all type  
equations are derived and simplified). Even then, I can use many high- 
level constructs (currying, generic functions, functors) -- they end  
up having zero runtime overhead. The approach is perhaps similar to  
what ocamldefun would do, it's just taken one step further.

I posit that dynamic memory allocation and garbage collection are a  
secondary problem. The primary problem is doing code analysis at such  
a level that the amount of dynamic memory allocation is reduced only  
to places where it's inherently needed. Same goes for boxing: unless  
OCaml would do whole-program compilation, some boxing is inevitable in  
light of the compiler being unable to reason about all of the code.

Kuba


      parent reply	other threads:[~2009-02-22 21:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-22 11:26 Philippe Strauss
2009-02-22 14:00 ` [Caml-list] " Jon Harrop
2009-02-22 21:41 ` Kuba Ober [this message]

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=17FAD835-1612-4ADA-B6D7-1B84CC52CC38@osu.edu \
    --to=ober.14@osu.edu \
    --cc=caml-list@yquem.inria.fr \
    /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).