caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Alain Frisch <alain.frisch@lexifi.com>
To: "Pierre-Marie Pédrot" <pierre-marie.pedrot@inria.fr>, caml-list@inria.fr
Subject: Re: [Caml-list] unmarshaling large data from string on 32 bits
Date: Thu, 05 Feb 2015 11:50:26 +0100	[thread overview]
Message-ID: <54D34AF2.1010001@lexifi.com> (raw)
In-Reply-To: <54D33EC3.2050809@inria.fr>

On 02/05/2015 10:58 AM, Pierre-Marie Pédrot wrote:
> On 05/02/2015 09:56, Alain Frisch wrote:
>> One possible work-around is to use an alternative implementation of the
>> demarshaler (there is such a pure OCaml implementation in Frama-C).
>> Another is to avoid the generic marshaling, either by writing a manual
>> version for your specific data type or by generating it from your type
>> definitions (à la bin-prot, I assume).
>
> Both workarounds would not work. Indeed, we use closure marshalling in
> Coq, which is not supported by the two proposed implementations.

Waow, closure marshaling across processes: you live dangerously :-)  I 
hope you know precisely which values go into the closures or not 
(exception slots, global mutable data structures, etc)...


> (Plus, that would be so slow I do not even want to think about it.)

I'm not so sure.  Serialization/deserialization routines specialized for 
specific data types avoid some runtime checks required by the generic 
functions (for the block tags and sizes, for detecting possible sharing 
everywhere) and can use more specialized (and thus more compact) data 
representation.

We have had that problem at LexiFi, where we used to rely on the generic 
marshaling for exchanges messages between processes (hence the ticket I 
referred to).  We finally decided to write (manually) specialized 
functions for our type of messages (no closures, no sharing), and the 
performance results where slower but reasonable compared to the generic 
marshaling (without putting too much engineering effort into it).  Anyway:

  - our previous workaround was to trigger Gc.compact explicitly for big 
messages, which was much worse, of course;

  - it's clear that the OCaml implementation of the generic demarshaler 
would be slower;

  - since this only impacts 32-bit systems, nobody seems motivated 
enough to put energy into fixing the core issue.


Alain

  parent reply	other threads:[~2015-02-05 10:51 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-02 10:32 Enrico Tassi
2015-02-02 12:00 ` Gabriel Scherer
2015-02-02 13:08   ` Pierre-Marie Pédrot
2015-02-04 16:47   ` Enrico Tassi
2015-02-04 23:51     ` Gerd Stolpmann
2015-02-05  8:56 ` Alain Frisch
2015-02-05  9:01   ` Gabriel Scherer
2015-02-05  9:34     ` Alain Frisch
2015-02-05  9:58   ` Pierre-Marie Pédrot
2015-02-05 10:33     ` Enrico Tassi
2015-02-05 10:50     ` Alain Frisch [this message]
2015-02-05 12:22       ` Fabrice Le Fessant
2015-02-05 12:24         ` Alain Frisch
2015-02-05 12:27       ` Enrico Tassi

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=54D34AF2.1010001@lexifi.com \
    --to=alain.frisch@lexifi.com \
    --cc=caml-list@inria.fr \
    --cc=pierre-marie.pedrot@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).