Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
adjustable arrays
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  Messages 1 - 25 of 34 - Collapse all  -  Translate all to Translated (View all originals)   Newer >
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Peter Keller  
View profile  
 More options Apr 29 2010, 10:21 am
Newsgroups: comp.lang.lisp
From: Peter Keller <psil...@merlin.cs.wisc.edu>
Date: 29 Apr 2010 14:21:49 GMT
Local: Thurs, Apr 29 2010 10:21 am
Subject: adjustable arrays
Hello,

I understand that I can adjust an array like this:

* (setf x (make-array 3 :initial-element 100))

#(100 100 100)

* (setf y (adjust-array x 6 :initial-element 42))

#(100 100 100 42 42 42)

My question is: This adjustment happens at the _end_ of the array, can I
expand the array at the beginning?

Could I do an adjustment on x where the final result is:

#(42 42 42 100 100 100)

Or do I have to write the code to allocate the larger array and manually copy
the elements myself?

Thank you.

-pete


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tamas K Papp  
View profile  
 More options Apr 29 2010, 10:42 am
Newsgroups: comp.lang.lisp
From: Tamas K Papp <tkp...@gmail.com>
Date: 29 Apr 2010 14:42:49 GMT
Local: Thurs, Apr 29 2010 10:42 am
Subject: Re: adjustable arrays

On Thu, 29 Apr 2010 14:21:49 +0000, Peter Keller wrote:
> My question is: This adjustment happens at the _end_ of the array, can I
> expand the array at the beginning?
> [...]
> Or do I have to write the code to allocate the larger array and manually
> copy the elements myself?

I think that you have to copy yourself - but that is rather easy to
do, see eg REPLACE.

In general, if you know that you will not prepend more than a given
number of elements (or you are willing to copy elements occasionally),
you can create an array that is large enough, and displace to it using an
offset.  Then if you need extra elements at the beginning, just displace
to a smaller offset.

Tamas


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
RG  
View profile  
 More options Apr 29 2010, 10:54 am
Newsgroups: comp.lang.lisp
From: RG <rNOSPA...@flownet.com>
Date: Thu, 29 Apr 2010 07:54:42 -0700
Local: Thurs, Apr 29 2010 10:54 am
Subject: Re: adjustable arrays
In article <4bd995fd$0$9895$80265...@spool.cs.wisc.edu>,
 Peter Keller <psil...@merlin.cs.wisc.edu> wrote:

You want a displaced (and adjustable) array.

? (setf a1 (make-array 30))
#(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)
? (dotimes (i 30) (setf (aref a1 i) i))
...
? a1
#(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
27 28 29)
? (setf a2 (make-array 10 :displaced-to a1 :displaced-index-offset 15
:adjustable t))
#(15 16 17 18 19 20 21 22 23 24)
? (adjust-array a1 '(15) :displaced-to a1 :displaced-index-offset 10)
#(10 11 12 13 14 15 16 17 18 19 20 21 22 23 24)

rg


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Peter Keller  
View profile  
 More options Apr 29 2010, 11:13 am
Newsgroups: comp.lang.lisp
From: Peter Keller <psil...@merlin.cs.wisc.edu>
Date: 29 Apr 2010 15:13:30 GMT
Local: Thurs, Apr 29 2010 11:13 am
Subject: Re: adjustable arrays

RG <rNOSPA...@flownet.com> wrote:
> You want a displaced (and adjustable) array.

> ? (setf a1 (make-array 30))
> #(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)
> ? (dotimes (i 30) (setf (aref a1 i) i))
> ...
> ? a1
> #(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
> 27 28 29)
> ? (setf a2 (make-array 10 :displaced-to a1 :displaced-index-offset 15
> :adjustable t))
> #(15 16 17 18 19 20 21 22 23 24)
> ? (adjust-array a1 '(15) :displaced-to a1 :displaced-index-offset 10)
> #(10 11 12 13 14 15 16 17 18 19 20 21 22 23 24)

I see.

If I knew how big the final sizes of the arrays were I could use
this method, but sadly I don't. I'll file away the method for another
day. It looks like under my circumstances, a new array into which I copy
all of my disparate pieces looks to be one of the only solutions.

Thank you for your time.

-pete


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
RG  
View profile  
 More options Apr 29 2010, 11:34 am
Newsgroups: comp.lang.lisp
From: RG <rNOSPA...@flownet.com>
Date: Thu, 29 Apr 2010 08:34:52 -0700
Local: Thurs, Apr 29 2010 11:34 am
Subject: Re: adjustable arrays
In article <4bd9a21a$0$9898$80265...@spool.cs.wisc.edu>,
 Peter Keller <psil...@merlin.cs.wisc.edu> wrote:

You can make the underlying array adjustable (but not displaced) so that
it can grow too.  If you need to grow it at both ends you can use two
adjustable arrays and roll your own displaced array class to do the
indirection.

rg


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tamas K Papp  
View profile  
 More options Apr 29 2010, 11:45 am
Newsgroups: comp.lang.lisp
From: Tamas K Papp <tkp...@gmail.com>
Date: 29 Apr 2010 15:45:19 GMT
Local: Thurs, Apr 29 2010 11:45 am
Subject: Re: adjustable arrays

Sometimes I face a similar problem (collecting an number of items that
are either unknown a prior, or I am lazy to calculate).  I usually
solve it the following way: create array with extra elements, keep
using them until I run out, then create a new array with a buffer of
extra elements, copy and continue.  This way, you will copy
occasionally, but not all the time.  Example:

(use-package '(:bind))

(defun prepend-elements (vector n &optional (extra 256))
  (bind (((:values displaced-to index-offset) (array-displacement vector))
         (new-length (+ n (length vector))))
    (if (and displaced-to (<= n index-offset))
        (make-array new-length
                    :displaced-index-offset (- index-offset n)
                    :displaced-to displaced-to)
        (let ((new-vector (make-array (+ extra new-length))))
          (replace new-vector vector :start1 (+ extra n))
          (make-array new-length
                      :displaced-index-offset extra
                      :displaced-to new-vector)))))

(defparameter *a* #(1 2 3))
(setf *a* (prepend-elements *a* 7))
(array-displacement *a*)                ; #(0 0 0 ...), 256

You can add bells and whistles, eg prepended element initialization,
etc.

Tamas


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Peter Keller  
View profile  
 More options Apr 29 2010, 12:12 pm
Newsgroups: comp.lang.lisp
From: Peter Keller <psil...@merlin.cs.wisc.edu>
Date: 29 Apr 2010 16:12:25 GMT
Local: Thurs, Apr 29 2010 12:12 pm
Subject: Re: adjustable arrays
Tamas K Papp <tkp...@gmail.com> wrote:

> Sometimes I face a similar problem (collecting an number of items that
> are either unknown a prior, or I am lazy to calculate).  I usually
> solve it the following way: create array with extra elements, keep
> using them until I run out, then create a new array with a buffer of
> extra elements, copy and continue.  This way, you will copy
> occasionally, but not all the time.  Example:

Yeah, I thought of that. But it turns out the layering in my code base makes
that difficult to acheive.

My use case is I'm writing a master/worker style communication system
which can handle 10,000 to 50,000 clients. Buffer management for me is
a serious issue and I need to really conserve memory and not grind the
allocator too much.

The context is that when writing a data array to a client, the buffer
management layer needs to wrap a header around the data before sending it.
I thought about not doing the wrapping at all--just write the small header
then the payload, but then that leads to alternating writes of a very
small amount of data and then a large amount of data. That oscillation
sucks from a network scheduling/bandwidth perspective. I need to write
as many bytes as I can as often as I can.

If it really looks like the write buffering will be problematic from
a memory allocation point of view, I can make pools of buffers which
are reusable for the assembling of the data.  I don't want to do that
initially since it is more code.

I was just wondering if I had missed something in Lisp's array management
which would allow me to grow an array at the head of the array. The
answer is somewhat yes, but I'd have to preallocate the array and that
means the application code would have to use a special abstraction of
make-array. There are problems with that I'd rather avoid.

I guess at this point, I'll just assemble the arrays naively and if the
profiler tells me there is a problem there, I'll look into it deeper.

Thank you.

-pete


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Giovanni Gigante  
View profile  
 More options Apr 29 2010, 12:43 pm
Newsgroups: comp.lang.lisp
From: Giovanni Gigante <g...@cidoc.iuav.it>
Date: Thu, 29 Apr 2010 18:43:13 +0200
Local: Thurs, Apr 29 2010 12:43 pm
Subject: Re: adjustable arrays

> My question is: This adjustment happens at the _end_ of the array, can I
> expand the array at the beginning?

Naive idea:
what about building a list (you can cons to the beginning of that) and
mapping it to an array only when you are done?

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mirko  
View profile  
 More options Apr 29 2010, 12:43 pm
Newsgroups: comp.lang.lisp
From: Mirko <mirko.vuko...@gmail.com>
Date: Thu, 29 Apr 2010 09:43:18 -0700 (PDT)
Local: Thurs, Apr 29 2010 12:43 pm
Subject: Re: adjustable arrays
On Apr 29, 12:12 pm, Peter Keller <psil...@merlin.cs.wisc.edu> wrote:

Could it be that a different data structure would be more
appropriate?  What about a tree?  (also, until recently, I had not
realized how many different kinds of tree there are (2-3, 2-3-4, left
leaning, etc). That would impact your access time, but in your case it
may be manageable, or you could first store in tree, and then transfer
into array.

Mirko


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
RG  
View profile  
 More options Apr 29 2010, 1:00 pm
Newsgroups: comp.lang.lisp
From: RG <rNOSPA...@flownet.com>
Date: Thu, 29 Apr 2010 10:00:48 -0700
Local: Thurs, Apr 29 2010 1:00 pm
Subject: Re: adjustable arrays
In article <4bd9afe9$0$9898$80265...@spool.cs.wisc.edu>,
 Peter Keller <psil...@merlin.cs.wisc.edu> wrote:

Seems to me then that what you want is not a growable array but rather
smarter write buffering.

> If it really looks like the write buffering will be problematic from
> a memory allocation point of view, I can make pools of buffers which
> are reusable for the assembling of the data.  I don't want to do that
> initially since it is more code.

> I was just wondering if I had missed something in Lisp's array management
> which would allow me to grow an array at the head of the array. The
> answer is somewhat yes, but I'd have to preallocate the array and that
> means the application code would have to use a special abstraction of
> make-array. There are problems with that I'd rather avoid.

> I guess at this point, I'll just assemble the arrays naively and if the
> profiler tells me there is a problem there, I'll look into it deeper.

That sounds like a fine plan.  Premature optimization and all that.  
Memcpy is pretty frickin' fast, particularly when compared to network
I/O.

rg


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Peter Keller  
View profile  
 More options Apr 29 2010, 1:14 pm
Newsgroups: comp.lang.lisp
From: Peter Keller <psil...@merlin.cs.wisc.edu>
Date: 29 Apr 2010 17:14:55 GMT
Local: Thurs, Apr 29 2010 1:14 pm
Subject: Re: adjustable arrays

Mirko <mirko.vuko...@gmail.com> wrote:
> Could it be that a different data structure would be more
> appropriate?  What about a tree?  (also, until recently, I had not
> realized how many different kinds of tree there are (2-3, 2-3-4, left
> leaning, etc). That would impact your access time, but in your case it
> may be manageable, or you could first store in tree, and then transfer
> into array.

I know a fair number of data structures, but most of them require consing
which is something I need to minimize. Luckily, the storage requirements
of my data aren't tree-like. Thank you for your suggesstion.

To give an example of the problems I'm facing, suppose I have 10,000 clients:

If I have a 16k initial read buffer for each client which can grow in
size up to 128k as needed, then just for the read buffers alone I'll need:

156MB up to 1.250GB of memory needed.

If I have about 20k data buffers I need for each client to write, then
the buffers required for writing are 195MB.

If I have about 20K in memory structures for each client, then another
195MB.

So, under worst case conditions (the clients send me 128KB results all the
time instead of averaging around 16K) for 10,000 clients, I need in total

546MB up to 1.640GB.

Now this needed memory for which I can easily account!

That is a lot of memory to keep resident and perform churn on and hence
why I'm very paranoid about consing or calling make-array.  I use other
libraries and things and who knows what their memory usages are. But
at the scaling levels I'm desiring, I have to pay attention to it.

-pete


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Peter Keller  
View profile  
 More options Apr 29 2010, 1:16 pm
Newsgroups: comp.lang.lisp
From: Peter Keller <psil...@merlin.cs.wisc.edu>
Date: 29 Apr 2010 17:16:36 GMT
Local: Thurs, Apr 29 2010 1:16 pm
Subject: Re: adjustable arrays

Giovanni Gigante <g...@cidoc.iuav.it> wrote:

>> My question is: This adjustment happens at the _end_ of the array, can I
>> expand the array at the beginning?

> Naive idea:
> what about building a list (you can cons to the beginning of that) and
> mapping it to an array only when you are done?

That doesn't solve the problem, suppose:

(#(1 2 3) (#4 5 6))

I still have to allocate a 6 element array somewhere to map all of that
into a single array: #(1 2 3 4 5 6)

-pete


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Peter Keller  
View profile  
 More options Apr 29 2010, 1:27 pm
Newsgroups: comp.lang.lisp
From: Peter Keller <psil...@merlin.cs.wisc.edu>
Date: 29 Apr 2010 17:27:14 GMT
Local: Thurs, Apr 29 2010 1:27 pm
Subject: Re: adjustable arrays

RG <rNOSPA...@flownet.com> wrote:
> In article <4bd9afe9$0$9898$80265...@spool.cs.wisc.edu>,
> Peter Keller <psil...@merlin.cs.wisc.edu> wrote:
>> The context is that when writing a data array to a client, the buffer
>> management layer needs to wrap a header around the data before sending it.
>> I thought about not doing the wrapping at all--just write the small header
>> then the payload, but then that leads to alternating writes of a very
>> small amount of data and then a large amount of data. That oscillation
>> sucks from a network scheduling/bandwidth perspective. I need to write
>> as many bytes as I can as often as I can.

> Seems to me then that what you want is not a growable array but rather
> smarter write buffering.

I do not deny that, have any references? The nice thing about lisp is I
can just go back into that layer and bash the code into something else
with relative ease.

>> I guess at this point, I'll just assemble the arrays naively and if the
>> profiler tells me there is a problem there, I'll look into it deeper.

> That sounds like a fine plan.  Premature optimization and all that.  
> Memcpy is pretty frickin' fast, particularly when compared to network
> I/O.

Speaking of memcpy, in lisp what is the equivalent of memcpy? replace?
Hrm... I should use that in a few places I stupidly wrote the byte copies
with a do loop.

Thanks for the oblique suggestsion. :)

-pete


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
RG  
View profile  
 More options Apr 29 2010, 2:02 pm
Newsgroups: comp.lang.lisp
From: RG <rNOSPA...@flownet.com>
Date: Thu, 29 Apr 2010 11:02:17 -0700
Local: Thurs, Apr 29 2010 2:02 pm
Subject: Re: adjustable arrays
In article <4bd9c172$0$9895$80265...@spool.cs.wisc.edu>,
 Peter Keller <psil...@merlin.cs.wisc.edu> wrote:

> RG <rNOSPA...@flownet.com> wrote:
> > In article <4bd9afe9$0$9898$80265...@spool.cs.wisc.edu>,
> > Peter Keller <psil...@merlin.cs.wisc.edu> wrote:
> >> The context is that when writing a data array to a client, the buffer
> >> management layer needs to wrap a header around the data before sending it.
> >> I thought about not doing the wrapping at all--just write the small header
> >> then the payload, but then that leads to alternating writes of a very
> >> small amount of data and then a large amount of data. That oscillation
> >> sucks from a network scheduling/bandwidth perspective. I need to write
> >> as many bytes as I can as often as I can.

> > Seems to me then that what you want is not a growable array but rather
> > smarter write buffering.

> I do not deny that, have any references?

Sorry, no.  But surely it's not that hard?

rg


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Peter Keller  
View profile  
 More options Apr 29 2010, 2:21 pm
Newsgroups: comp.lang.lisp
From: Peter Keller <psil...@merlin.cs.wisc.edu>
Date: 29 Apr 2010 18:21:05 GMT
Local: Thurs, Apr 29 2010 2:21 pm
Subject: Re: adjustable arrays

Yeah, it shouldn't be that hard. When it comes to it, I'll just look in the
usual place for papers or descriptions of what people already do.

Thanks for your help.

Later,
-pete


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tamas K Papp  
View profile  
 More options Apr 29 2010, 2:46 pm
Newsgroups: comp.lang.lisp
From: Tamas K Papp <tkp...@gmail.com>
Date: 29 Apr 2010 18:46:17 GMT
Local: Thurs, Apr 29 2010 2:46 pm
Subject: Re: adjustable arrays

On Thu, 29 Apr 2010 17:27:14 +0000, Peter Keller wrote:
> Speaking of memcpy, in lisp what is the equivalent of memcpy? replace?
> Hrm... I should use that in a few places I stupidly wrote the byte
> copies with a do loop.

Pretty much.  Usually, if you want top speed, it pays to look into
your implementations sources and see what they use, then call that
directly.  Or, alternatively, declare array types so that the compiler
will do that for you.  Eg look at the transforms related to REPLACE in
SBCL, you will see that it will be heavily optimized when given enough
information.

Tamas


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Paul Wallich  
View profile  
 More options Apr 29 2010, 4:11 pm
Newsgroups: comp.lang.lisp
From: Paul Wallich <p...@panix.com>
Date: Thu, 29 Apr 2010 16:11:02 -0400
Local: Thurs, Apr 29 2010 4:11 pm
Subject: Re: adjustable arrays

Peter Keller wrote:
> Giovanni Gigante <g...@cidoc.iuav.it> wrote:
>>> My question is: This adjustment happens at the _end_ of the array, can I
>>> expand the array at the beginning?

>> Naive idea:
>> what about building a list (you can cons to the beginning of that) and
>> mapping it to an array only when you are done?

> That doesn't solve the problem, suppose:

> (#(1 2 3) (#4 5 6))

> I still have to allocate a 6 element array somewhere to map all of that
> into a single array: #(1 2 3 4 5 6)

Do you know for sure that you can do a better job managing all these
bits than the garbage collector can. If many/most of incoming chunks of
data are short-lived, GC might do better than all the copying.

paul    working first, fast later


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Espen Vestre  
View profile  
 More options Apr 29 2010, 4:31 pm
Newsgroups: comp.lang.lisp
From: Espen Vestre <es...@vestre.net>
Date: Thu, 29 Apr 2010 22:31:26 +0200
Local: Thurs, Apr 29 2010 4:31 pm
Subject: Re: adjustable arrays

Peter Keller <psil...@merlin.cs.wisc.edu> writes:
> I was just wondering if I had missed something in Lisp's array management
> which would allow me to grow an array at the head of the array. The
> answer is somewhat yes, but I'd have to preallocate the array and that
> means the application code would have to use a special abstraction of
> make-array. There are problems with that I'd rather avoid.

Can't you just use the array as a "growable ring buffer"? If the ring
buffer is full, you grow the array, and you can move the start or the
end pointers into your buffer depending on where you want to add data.

(I use one ring buffer per client in a server I've written, but they're
fixed-size with 30000 elements, because in my case if the clients have
a lag of that many transactions, it's better for the clients if the
server just flushes part of its buffer)
--
  (espen)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Peter Keller  
View profile  
 More options Apr 29 2010, 8:22 pm
Newsgroups: comp.lang.lisp
From: Peter Keller <psil...@merlin.cs.wisc.edu>
Date: 30 Apr 2010 00:22:27 GMT
Local: Thurs, Apr 29 2010 8:22 pm
Subject: Re: adjustable arrays

Espen Vestre <es...@vestre.net> wrote:
> Peter Keller <psil...@merlin.cs.wisc.edu> writes:

>> I was just wondering if I had missed something in Lisp's array management
>> which would allow me to grow an array at the head of the array.

This idea I might check out in more detail.... Thanks!

-pete


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Peter Keller  
View profile  
 More options Apr 29 2010, 8:23 pm
Newsgroups: comp.lang.lisp
From: Peter Keller <psil...@merlin.cs.wisc.edu>
Date: 30 Apr 2010 00:23:36 GMT
Local: Thurs, Apr 29 2010 8:23 pm
Subject: Re: adjustable arrays

Paul Wallich <p...@panix.com> wrote:
> Do you know for sure that you can do a better job managing all these
> bits than the garbage collector can. If many/most of incoming chunks of
> data are short-lived, GC might do better than all the copying.

I don't know for sure, it is just a feeling I have for where a nsaty thing
might happen.

> paul    working first, fast later

That is very true, I don't so much want fast, as resident in memory. :)

Thank you all for your suggestions! They have been very helpful!

-pete


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Robert Maas, http://tinyurl.com/uh3t  
View profile  
 More options May 2 2010, 3:39 am
Newsgroups: comp.lang.lisp
From: seeWebInst...@rem.intarweb.org (Robert Maas, http://tinyurl.com/uh3t)
Date: Sat, 01 May 2010 23:39:50 -0800
Local: Sun, May 2 2010 3:39 am
Subject: Re: adjustable arrays

> From: Peter Keller <psil...@merlin.cs.wisc.edu>
> If I knew how big the final sizes of the arrays were I could use
> this method, but sadly I don't.

I suggest that you define a new ADT (Abstract Data Type) which
provides *exactly* the functionality you want. Once that's well
defined, we can brainstorm how to best implement it. For example,
you might implement a virtual array as multiple chunks, each a
fixed-size (non-adjustable) array, collected together by a
self-balancing binary-search-tree whose leaves are the chunks. This
would let you insert new segments (chunks) at the start, at the
end, or anywhere in the middle, with no need to ever copy blocks of
data from an old array to a new array.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Robert Maas, http://tinyurl.com/uh3t  
View profile  
 More options May 2 2010, 3:57 am
Newsgroups: comp.lang.lisp
From: seeWebInst...@rem.intarweb.org (Robert Maas, http://tinyurl.com/uh3t)
Date: Sat, 01 May 2010 23:57:25 -0800
Local: Sun, May 2 2010 3:57 am
Subject: Re: adjustable arrays

> From: Peter Keller <psil...@merlin.cs.wisc.edu>
> To give an example of the problems I'm facing, suppose I have 10,000 clients:
> If I have a 16k initial read buffer for each client which can grow in
> size up to 128k as needed, then just for the read buffers alone I'll need:
> 156MB up to 1.250GB of memory needed.
> ...
> That is a lot of memory to keep resident and perform churn on and hence
> why I'm very paranoid about consing or calling make-array.  I use other
> libraries and things and who knows what their memory usages are. But
> at the scaling levels I'm desiring, I have to pay attention to it.

With so many clients you must synchronize, why even *try* to store
the data in Lisp arrays? Why not use MySQL as your datastore, or if
you need higher performance and have lots of $cash$ then use Oracle
instead?

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tim Bradshaw  
View profile  
 More options May 2 2010, 4:28 am
Newsgroups: comp.lang.lisp
From: Tim Bradshaw <t...@tfeb.org>
Date: Sun, 2 May 2010 09:28:12 +0100
Local: Sun, May 2 2010 4:28 am
Subject: Re: adjustable arrays
On 2010-04-29 18:14:55 +0100, Peter Keller said:

> 546MB up to 1.640GB.

> Now this needed memory for which I can easily account!

> That is a lot of memory to keep resident and perform churn on and hence
> why I'm very paranoid about consing or calling make-array.  I use other
> libraries and things and who knows what their memory usages are. But
> at the scaling levels I'm desiring, I have to pay attention to it.

10 years ago this was a lot of memory.  Now it's small change.  50 or
100G is something to think about, but less than 4 doesn't count for
much unless you're planning on some vast number of instances.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Espen Vestre  
View profile  
 More options May 2 2010, 4:48 am
Newsgroups: comp.lang.lisp
From: Espen Vestre <es...@vestre.net>
Date: Sun, 02 May 2010 10:48:38 +0200
Local: Sun, May 2 2010 4:48 am
Subject: Re: adjustable arrays

Tim Bradshaw <t...@tfeb.org> writes:
> 10 years ago this was a lot of memory.  Now it's small change.  50 or
> 100G is something to think about, but less than 4 doesn't count for
> much unless you're planning on some vast number of instances.

It depends a bit on the life time of the memory and the requirements of
your server. I have one server application instance that uses 6-7GB of
memory, and which needs to run a full GC freeing most of that once a
day. That takes a about 5 seconds (I think, I haven't looked at it in
detail for a while, it runs for months without problems now), which is
not critical at all for *this* server, since I can run the GC at 2 in
the morning when the server rarely is needed. But other applications may
have other requirements.
--
  (espen)

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tim Bradshaw  
View profile  
 More options May 2 2010, 8:40 am
Newsgroups: comp.lang.lisp
From: Tim Bradshaw <t...@tfeb.org>
Date: Sun, 2 May 2010 13:40:33 +0100
Local: Sun, May 2 2010 8:40 am
Subject: Re: adjustable arrays
On 2010-05-02 09:48:38 +0100, Espen Vestre said:

> It depends a bit on the life time of the memory and the requirements of
> your server. I have one server application instance that uses 6-7GB of
> memory, and which needs to run a full GC freeing most of that once a
> day. That takes a about 5 seconds (I think, I haven't looked at it in
> detail for a while, it runs for months without problems now), which is
> not critical at all for *this* server, since I can run the GC at 2 in
> the morning when the server rarely is needed. But other applications may
> have other requirements.

I think that if GCs have problems which make using large heaps
difficult (and 6 or 7GB is not really large), then GC implementation
need to get better - perhaps the Azul people are right about that.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Messages 1 - 25 of 34   Newer >
« Back to Discussions « Newer topic     Older topic »