Loading ...
Sorry, an error occurred while loading the content.

Re: "ocaml_beginners"::[] what limits Sys.max_string_length and can it be increased ?

Expand Messages
  • Hongbo Zhang
    Hi Sergei, try 64 bit ocaml. The length limit is due to the data representation chosen by ocaml. ... -- -- Regards, Hongbo [Non-text portions of this message
    Message 1 of 6 , Feb 20, 2013
    • 0 Attachment
      Hi Sergei, try 64 bit ocaml. The length limit is due to the data
      representation chosen by ocaml.

      On Wed, Feb 20, 2013 at 6:41 PM, Sergei Steshenko <sergstesh@...>wrote:

      > **
      >
      >
      > Hello,
      >
      > I've checked Sys.max_string_length:
      >
      > "
      > # Sys.max_string_length;;
      > - : int = 16777211
      > ".
      >
      > By my standards it's a small value. For example, in Perl strings can have
      > whatever length - of course, limited by available memory.
      >
      > Why in OCaml (or in the module) the value is limited by approximately 16M
      > and can it be increased ?
      >
      > Thanks,
      > Sergei.
      >
      >



      --
      -- Regards, Hongbo


      [Non-text portions of this message have been removed]
    • Sergei Steshenko
      Even though my desktop (but not laptop) CPU is capable of running 64 bits, I still prefer 32 bit versions of Linux for various practical reasons. Could you
      Message 2 of 6 , Feb 20, 2013
      • 0 Attachment
        Even though my desktop (but not laptop) CPU is capable of running 64 bits, I still prefer 32 bit versions of Linux for various practical reasons.

        Could you shed some light on data representation in OCaml ? AFAIK integers are 31 rather than 32 bits - which according to my (naive ?) understanding should limit things from 4G to 2G. And that would be OK for me.

        But why 16M ?

        Thanks,
          Sergei.




        ----- Original Message -----
        > From: Hongbo Zhang <hongboz@...>
        > To: ocaml_beginners@yahoogroups.com
        > Cc:
        > Sent: Thursday, February 21, 2013 1:45 AM
        > Subject: Re: "ocaml_beginners"::[] what limits Sys.max_string_length and can it be increased ?
        >
        > Hi Sergei, try 64 bit ocaml. The length limit is due to the data
        > representation chosen by ocaml.
        >
        > On Wed, Feb 20, 2013 at 6:41 PM, Sergei Steshenko
        > <sergstesh@...>wrote:
        >
        >> **
        >>
        >>
        >> Hello,
        >>
        >> I've checked Sys.max_string_length:
        >>
        >> "
        >> # Sys.max_string_length;;
        >> - : int = 16777211
        >> ".
        >>
        >> By my standards it's a small value. For example, in Perl strings can
        > have
        >> whatever length - of course, limited by available memory.
        >>
        >> Why in OCaml (or in the module) the value is limited by approximately 16M
        >> and can it be increased ?
        >>
        >> Thanks,
        >> Sergei.
        >>  
        >>
        >
        >
        >
        > --
        > -- Regards, Hongbo
        >
        >
        > [Non-text portions of this message have been removed]
        >
        >
        >
        > ------------------------------------
        >
        > Archives up to December 31, 2011 are also downloadable at
        > http://www.connettivo.net/cntprojects/ocaml_beginners
        > The archives of the very official ocaml list (the seniors' one) can be found
        > at http://caml.inria.fr
        > Attachments are banned and you're asked to be polite, avoid flames
        > etc.Yahoo! Groups Links
        >
        >
        >
      • oliver
        ... [...] Initially OCaml was written/designed with 64 Bit systems in mind. Later, when it shows up that 32 Bit machines will stay on market for quite long
        Message 3 of 6 , Feb 20, 2013
        • 0 Attachment
          On Wed, Feb 20, 2013 at 03:52:56PM -0800, Sergei Steshenko wrote:
          >
          >
          > Even though my desktop (but not laptop) CPU is capable of running 64 bits,
          > I still prefer 32 bit versions of Linux for various practical reasons.
          [...]


          Initially OCaml was written/designed with 64 Bit systems in mind.
          Later, when it shows up that 32 Bit machines will stay on market for quite long time,
          OCaml was "backported".

          I think it was Xavier Leroy who answered this many years ago,
          when I asked the same question like you.


          Let us remember: HP-workstations, HP 9000 series has had 32 Bit processors.
          It was in 1982.

          As you may now, we have 2013 now.

          Using 32 Bit machines today is using ancient technology.
          The big vendors of Hardware and Software, which so often
          tell us, that they are innovative and provide newest technology,
          has thwarted the progress over decades.

          There is no excuse for this.
          Even embedded systems do have 8, 16 or 32 Bit processors.


          Fronm the manual:

          Character strings

          String values are finite sequences of characters. The current implementation
          supports strings containing up to 2^24 − 5 characters (16777211 characters);
          on 64-bit platforms, the limit is 2^57 − 9.

          http://caml.inria.fr/pub/docs/manual-ocaml-4.00/manual010.html#toc40



          >
          > Could you shed some light on data representation in OCaml ? AFAIK integers
          > are 31 rather than 32 bits - which according to my (naive ?) understanding
          > should limit things from 4G to 2G. And that would be OK for me.
          >
          > But why 16M ?


          I also found this stuff here:

          https://sympa.inria.fr/sympa/arc/caml-list/2003-01/msg00041.html

          http://rwmj.wordpress.com/2009/08/05/ocaml-internals-part-2-strings-and-other-types/


          I think for just using OCaml, this does not matter.
          Just use it as is.
          But you asked for some information.

          HTH

          Ciao,
          Oliver
        • Francois Berenger
          Gabriel mentioned the rope data structure. That would allow you to create giant strings, I guess. There are several implementations in OCaml.
          Message 4 of 6 , Feb 20, 2013
          • 0 Attachment
            Gabriel mentioned the rope data structure.
            That would allow you to create giant strings, I guess.
            There are several implementations in OCaml.

            https://www.lri.fr/~filliatr/ftp/ocaml/ds/rope.mli.html
            http://batteries.forge.ocamlcore.org/doc.preview:batteries-beta1/html/api/Rope.html

            If that's not enough, then just use a file on disk! :)

            On 02/21/2013 08:52 AM, Sergei Steshenko wrote:
            > Even though my desktop (but not laptop) CPU is capable of running 64
            > bits, I still prefer 32 bit versions of Linux for various practical reasons.
            >
            > Could you shed some light on data representation in OCaml ? AFAIK
            > integers are 31 rather than 32 bits - which according to my (naive ?)
            > understanding should limit things from 4G to 2G. And that would be OK
            > for me.
            >
            > But why 16M ?
            >
            > Thanks,
            > Sergei.
            >
            > ----- Original Message -----
            > > From: Hongbo Zhang hongboz@...
            > <mailto:hongboz%40seas.upenn.edu>>
            > > To: ocaml_beginners@yahoogroups.com
            > <mailto:ocaml_beginners%40yahoogroups.com>
            > > Cc:
            > > Sent: Thursday, February 21, 2013 1:45 AM
            > > Subject: Re: "ocaml_beginners"::[] what limits Sys.max_string_length
            > and can it be increased ?
            > >
            > > Hi Sergei, try 64 bit ocaml. The length limit is due to the data
            > > representation chosen by ocaml.
            > >
            > > On Wed, Feb 20, 2013 at 6:41 PM, Sergei Steshenko
            > > sergstesh@... <mailto:sergstesh%40yahoo.com>>wrote:
            > >
            > >> **
            > >>
            > >>
            > >> Hello,
            > >>
            > >> I've checked Sys.max_string_length:
            > >>
            > >> "
            > >> # Sys.max_string_length;;
            > >> - : int = 16777211
            > >> ".
            > >>
            > >> By my standards it's a small value. For example, in Perl strings can
            > > have
            > >> whatever length - of course, limited by available memory.
            > >>
            > >> Why in OCaml (or in the module) the value is limited by
            > approximately 16M
            > >> and can it be increased ?
            > >>
            > >> Thanks,
            > >> Sergei.
            > >>
            > >>
            > >
            > >
            > >
            > > --
            > > -- Regards, Hongbo
            > >
            > >
            > > [Non-text portions of this message have been removed]
            > >
            > >
            > >
            > > ------------------------------------
            > >
            > > Archives up to December 31, 2011 are also downloadable at
            > > http://www.connettivo.net/cntprojects/ocaml_beginners
            > > The archives of the very official ocaml list (the seniors' one) can
            > be found
            > > at http://caml.inria.fr
            > > Attachments are banned and you're asked to be polite, avoid flames
            > > etc.Yahoo! Groups Links
            > >
            > >
            > >
            >
            >
          • Gabriel Scherer
            Ropes are indeed a reasonable choice for long strings. Another solution is to use Bigarray (
            Message 5 of 6 , Feb 21, 2013
            • 0 Attachment
              Ropes are indeed a reasonable choice for long strings. Another solution is
              to use Bigarray (
              http://caml.inria.fr/pub/docs/manual-ocaml-4.00/libref/Bigarray.html ),
              which supports array of arbitrary size, including arrays of chars. As far
              as I know, however, the library support for using Bigarray as strings is
              presently poor (that would be a worthy contribution to the OCaml
              ecosystem), so you'd have to recode most input/output functions, buffer
              etc., on top of Bigarrays.

              On Thu, Feb 21, 2013 at 3:21 AM, Francois Berenger <berenger@...>wrote:

              > Gabriel mentioned the rope data structure.
              > That would allow you to create giant strings, I guess.
              > There are several implementations in OCaml.
              >
              > https://www.lri.fr/~filliatr/ftp/ocaml/ds/rope.mli.html
              >
              > http://batteries.forge.ocamlcore.org/doc.preview:batteries-beta1/html/api/Rope.html
              >
              > If that's not enough, then just use a file on disk! :)
              >
              > On 02/21/2013 08:52 AM, Sergei Steshenko wrote:
              > > Even though my desktop (but not laptop) CPU is capable of running 64
              > > bits, I still prefer 32 bit versions of Linux for various practical
              > reasons.
              > >
              > > Could you shed some light on data representation in OCaml ? AFAIK
              > > integers are 31 rather than 32 bits - which according to my (naive ?)
              > > understanding should limit things from 4G to 2G. And that would be OK
              > > for me.
              > >
              > > But why 16M ?
              > >
              > > Thanks,
              > > Sergei.
              > >
              > > ----- Original Message -----
              > > > From: Hongbo Zhang hongboz@...
              > > <mailto:hongboz%40seas.upenn.edu>>
              > > > To: ocaml_beginners@yahoogroups.com
              > > <mailto:ocaml_beginners%40yahoogroups.com>
              > > > Cc:
              > > > Sent: Thursday, February 21, 2013 1:45 AM
              > > > Subject: Re: "ocaml_beginners"::[] what limits Sys.max_string_length
              > > and can it be increased ?
              > > >
              > > > Hi Sergei, try 64 bit ocaml. The length limit is due to the data
              > > > representation chosen by ocaml.
              > > >
              > > > On Wed, Feb 20, 2013 at 6:41 PM, Sergei Steshenko
              > > > sergstesh@... <mailto:sergstesh%40yahoo.com>>wrote:
              > > >
              > > >> **
              > > >>
              > > >>
              > > >> Hello,
              > > >>
              > > >> I've checked Sys.max_string_length:
              > > >>
              > > >> "
              > > >> # Sys.max_string_length;;
              > > >> - : int = 16777211
              > > >> ".
              > > >>
              > > >> By my standards it's a small value. For example, in Perl strings can
              > > > have
              > > >> whatever length - of course, limited by available memory.
              > > >>
              > > >> Why in OCaml (or in the module) the value is limited by
              > > approximately 16M
              > > >> and can it be increased ?
              > > >>
              > > >> Thanks,
              > > >> Sergei.
              > > >>
              > > >>
              > > >
              > > >
              > > >
              > > > --
              > > > -- Regards, Hongbo
              > > >
              > > >
              > > > [Non-text portions of this message have been removed]
              > > >
              > > >
              > > >
              > > > ------------------------------------
              > > >
              > > > Archives up to December 31, 2011 are also downloadable at
              > > > http://www.connettivo.net/cntprojects/ocaml_beginners
              > > > The archives of the very official ocaml list (the seniors' one) can
              > > be found
              > > > at http://caml.inria.fr
              > > > Attachments are banned and you're asked to be polite, avoid flames
              > > > etc.Yahoo! Groups Links
              > > >
              > > >
              > > >
              > >
              > >
              >
              >
              >
              > ------------------------------------
              >
              > Archives up to December 31, 2011 are also downloadable at
              > http://www.connettivo.net/cntprojects/ocaml_beginners
              > The archives of the very official ocaml list (the seniors' one) can be
              > found at http://caml.inria.fr
              > Attachments are banned and you're asked to be polite, avoid flames
              > etc.Yahoo! Groups Links
              >
              >
              >
              >


              [Non-text portions of this message have been removed]
            Your message has been successfully submitted and would be delivered to recipients shortly.