caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jon Harrop <jon@ffconsultancy.com>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] More Caml
Date: Wed, 24 Dec 2008 16:47:03 +0000	[thread overview]
Message-ID: <200812241647.03447.jon@ffconsultancy.com> (raw)
In-Reply-To: <caee5ad80812240512q5dfbfafeoad6dabc8f0f93bea@mail.gmail.com>

On Wednesday 24 December 2008 13:12:58 Mikkel Fahnøe Jørgensen wrote:
> 2008/12/23 Jon Harrop <jon@ffconsultancy.com>:
> > symbolics. I am guessing the performance of allocation will be degraded
> > 10-100x but many allocations can be removed. This leaves me wondering how
> > much slowdown is acceptable without deterring a lot of users?
>
> I think this would be major problem. A great advantage of OCaml is
> that you can do things you would not normally do in C/C++ for
> performance reasons, like mapping a list.

Yes. The counter argument is that people wanting performance should not be 
using long linked lists in the first place. I think that is actually quite a 
compelling argument: it is more important to remove barriers to potential 
performance than it is to make everything fast.

Indeed, that is one of the strongest reasons to choose OCaml over the 
alternatives: you can write very fast code in OCaml without having to drop to 
C. In contrast, Haskell compilers do a lot of generic optimizations like 
deforesting that help in unimportant cases but place a low performance 
ceiling on fast code so you are forced to drop to another language for speed.

> I believe it is desirable to split allocation into pools dedicated to
> each physical thread.

Absolutely. However, that is also extremely complicated and I just cannot see 
myself implementing that any time soon. A parallel GC using a shadow stack 
seems feasible and should still be a productive improvement. Symbolic code 
will really suffer but numeric code will really gain.

> Memory barriers are really expensive, such as used for atomic increment, not
> to mention locking. 

Particularly when mutating pointers to reference types in the heap. However, 
reading and writing value types in the heap should still be fast, e.g. 
parallel numerical methods.

> Small block 
> allocation could be done in relatively small heap segments where each
> physical thread locks a larger heap only when it needs a new segment,
> but not while allocating within a segment. This can further be
> improved by adding NUMA support and scope based allocation (arena). If
> full segments are marked non-mutable where possible, it is probably
> possible to reduce thread blocking during collection. Garbage
> collection could be limited to processing full segments. Probably not
> trivial though.

Indeed. There are also a variety of type-directed approaches that may be 
useful given the information available to the JIT. Not to mention that I'm 
expecting to JIT the GC code for each type as well... :-)

Incidentally, the availability of fences as intrinsics in LLVM makes it sound 
ideal for implementing GCs using wait-free methods. If I can get the basics 
up and running then it may be best for me to focus on making this VM an easy 
target for GC researchers to implement new algorithms.

> How do you think of adding an Erlang style threading model?

That is effectively what F#'s asynchronous workflows aim to achieve. However, 
I currently have no use for it so I only desire that its existence does not 
limit the capabilities that I am interested in (parallelism).

> Speaking of JIT compiler, would eval make any sense?

Yes, no reason why not. Perhaps the same infrastructure used to type 
specialize definitions as they are JIT compiled can be used for other kinds 
of partial specialization, like low-dimensional vector/matrix operations.

-- 
Dr Jon Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?e


  reply	other threads:[~2008-12-24 16:43 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-19 13:04 More cores Mikkel Fahnøe Jørgensen
2008-12-19 14:04 ` [Caml-list] " Dario Teixeira
2008-12-19 15:06   ` Alexy Khrabrov
2008-12-19 15:54     ` The Axis of Eval (was: More cores) Dario Teixeira
2008-12-19 16:26       ` [Caml-list] " Paolo Donadeo
2008-12-19 17:01       ` Dario Teixeira
2008-12-19 18:01         ` Christophe Raffalli
2008-12-19 18:50     ` [Caml-list] More cores Ulf Wiger (TN/EAB)
2008-12-19 19:10   ` Richard Jones
2008-12-19 22:31   ` Jon Harrop
2008-12-19 22:36     ` Erik de Castro Lopo
2008-12-19 22:53       ` Jon Harrop
2008-12-22 17:00         ` [Caml-list] More Caml Jon Harrop
2008-12-22 21:44           ` Richard Jones
2008-12-23  6:07             ` Jon Harrop
2008-12-23  9:59               ` Jon Harrop
2008-12-23 15:32                 ` Ashish Agarwal
2008-12-23 17:33                   ` Jon Harrop
2008-12-24 13:12                 ` Mikkel Fahnøe Jørgensen
2008-12-24 16:47                   ` Jon Harrop [this message]
2008-12-23 10:04               ` Richard Jones
2008-12-23 10:38                 ` Jon Harrop
2008-12-23  9:43           ` Oliver Bandel
2008-12-23 11:53             ` Jon Harrop
2008-12-19 22:42     ` [Caml-list] More cores Richard Jones
2008-12-20 19:33     ` Mikkel Fahnøe Jørgensen
2008-12-20 19:41       ` Mikkel Fahnøe Jørgensen
2008-12-19 20:37 ` Oliver Bandel
2008-12-19 21:27   ` Richard Jones
2008-12-19 22:03     ` Hezekiah M. Carty
2008-12-19 22:47       ` Richard Jones
2008-12-19 23:00         ` Alexy Khrabrov
2008-12-19 23:56         ` prelude.ml as another standard extension to Pervasives? Alexy Khrabrov
2008-12-20  1:40           ` [Caml-list] " Mikkel Fahnøe Jørgensen
2008-12-20  4:50             ` Alexy Khrabrov
2008-12-20 10:53               ` Zheng Li
2008-12-20 12:37         ` [Caml-list] More cores Richard Jones

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=200812241647.03447.jon@ffconsultancy.com \
    --to=jon@ffconsultancy.com \
    --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).