caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Alain Frisch <alain.frisch@lexifi.com>
To: Nils Becker <nils.becker@bioquant.uni-heidelberg.de>,
	"caml-list@inria.fr" <caml-list@inria.fr>
Subject: Re: [Caml-list] Ocaml optimizer pitfalls & work-arounds
Date: Thu, 19 Jan 2017 15:35:41 +0100	[thread overview]
Message-ID: <d76b7c7c-431c-7cde-b257-004db15bb6b7@lexifi.com> (raw)
In-Reply-To: <64e5fca1-a5da-9ff5-ad90-b23343d17360@bioquant.uni-heidelberg.de>

On 19/01/2017 12:20, Nils Becker wrote:
> a while ago there was a proposal for deprecating the specialized
> treatment of float arrays, which was not accepted iirc.

For future reference, here are some relevant links:

   https://www.lexifi.com/blog/about-unboxed-float-arrays
   https://github.com/ocaml/ocaml/pull/163
   https://github.com/ocaml/ocaml/pull/616

> it seems that
> the slowdown of all Array.get calls is quite a high price to pay. what
> do we gain from the float array specialization? (honest question - i
> don't have a good understanding)

As far as I understand, the main argument for keeping the special 
current hack is that it helps beginners writing naive numerical code get 
something not horribly inefficient, while most proponents of removing 
the hack are advanced users who feel that the current situation gets in 
the way towards very efficient code.

Providing a FloatArray module would address parts of the concerns from 
these advanced users.  At least it would allow better optimization of 
numerical code, and pave the way for a future deprecation/removal of the 
special hack.  It would not address bad consequences of the special hack 
on (i) the performance of generic array accesses would remain and (ii) 
the complexity and corner cases in the compiler and runtime system.


(Another argument in favor of the status quo is that writing 
"FloatArray.get a i" is syntactically heavier than "a.(i)". 
Interestingly, I don't feel that the ability to write polymorphic code 
on arrays and apply it to (unboxed) float arrays is considered as a very 
important property.)

-- Alain

  parent reply	other threads:[~2017-01-19 14:36 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-19  6:51 Mark Hayden
2017-01-19 11:20 ` Nils Becker
2017-01-19 11:39   ` Gabriel Scherer
2017-01-19 13:26     ` Frédéric Bour
2017-01-19 14:35   ` Alain Frisch [this message]
2017-01-19 15:35     ` Ivan Gotovchits
2017-01-19 17:02       ` Hezekiah M. Carty
2017-01-19 15:41     ` Gerd Stolpmann
2017-01-19 13:41 ` Yaron Minsky
2017-01-19 17:59   ` Mark Hayden
2017-01-19 22:30     ` Yaron Minsky
2017-01-22 20:06       ` Berke Durak
2017-01-23 16:33         ` David McClain
2017-01-21 14:39 ` [Caml-list] <DKIM> " Pierre Chambart
2017-01-19 14:32 [Caml-list] " Hongbo Zhang (BLOOMBERG/ 731 LEX)

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=d76b7c7c-431c-7cde-b257-004db15bb6b7@lexifi.com \
    --to=alain.frisch@lexifi.com \
    --cc=caml-list@inria.fr \
    --cc=nils.becker@bioquant.uni-heidelberg.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).