From: Brian Hurt <bhurt@janestcapital.com>
To: me@hal3.name
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] non-square big arrays
Date: Tue, 06 Feb 2007 16:16:03 -0500 [thread overview]
Message-ID: <45C8F013.5050509@janestcapital.com> (raw)
In-Reply-To: <45C8EC31.6060300@cs.utah.edu>
Hal Daume III wrote:
>I have code that, right now, uses "int array array" to store lots of
>things, but in some cases I run out of indices in the outer array (the
>inner arrays are always fine, but I hit the max array length limit on
>the outside).
>
>I would be happy to switch over to bigarrays, but my understanding is
>that 2D bigarrays have to be square. I cannot possible have square
>arrays (it would take too much memory). Is there an obvious way around
>this that I'm missing?
>
>
>
I don't think so. 2D bigarrays are basically C pointer arithmetic
games. My recommendations would be, in order:
1) switch to 64 bit if at all humanly possible, at which point the
problem goes away. Also, you're likely to be hitting memory limits in
any case. If each subarray takes more than a few hundred bytes of
space, you'll be blowing 32-bit address space.
2) Make a new "hugearray" module which creates a virutal array that can
be larger than the limit of simple arrays by storing it in an array of
arrays. This isn't that hard to write. Keep the top level array small
(1024 entries should be large enough) so it lives in cache, and the
implementation probably wouldn't be signifigantly slower than a single
flat array.
Brian
prev parent reply other threads:[~2007-02-06 21:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-06 20:59 Hal Daume III
2007-02-06 21:16 ` Brian Hurt [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=45C8F013.5050509@janestcapital.com \
--to=bhurt@janestcapital.com \
--cc=caml-list@yquem.inria.fr \
--cc=me@hal3.name \
/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).