Does Gambit have a counter for "number of live, non-still objects?" Essentially this is what I need to minimize now, and being able to benchmark it will be helpful.<br><br>Thanks!<br><br><div class="gmail_quote">
On Sun, Jun 14, 2009 at 7:19 AM, Marc Feeley <span dir="ltr"><<a href="mailto:feeley@iro.umontreal.ca">feeley@iro.umontreal.ca</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im"><br>
On 14-Jun-09, at 9:35 AM, lowly coder wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
In the code running at 100fps, I do a minimal amount of allocating. It's practiaclly:<br>
<br>
(vector-for-map *some-vec* draw-object)<br>
<br>
(define (draw-object x)<br>
  (call some gl-rotate / gl-translate)<br>
  (gl/CallList x))<br>
<br>
<br>
However, I do have  _ALOT_ of static data lying around. In fact, I have large geometric models (from which I derive the open gl display lists) lying around in memory. They're vectors of lists / other vectors / other lists / ... of points / quads.<br>

<br>
This data also doesn't change, except at _very_ predefined locations.<br>
<br>
I guess if I can do somethign like:<br>
<br>
(##gc)<br>
( somehow tell gambit that the data currently left over is mostly static? )<br>
<br>
... continue running ...<br>
<br>
<br>
That sould be ideal.<br>
<br>
why does vector vs list mater much for ##still-copy ?<br>
<br>
Thanks!<br>
</blockquote>
<br></div>
Are you using plain Scheme vectors to store your numeric data?  Here it will pay off to use f32vectors, f64vectors or any homogeneous numerical vectors.  That's because the content of these vectors are not scanned by the garbage collector.  As I said in a previous message, if these vectors are still objects they will not be moved by the garbage collector, which further reduces the time needed.  You can force an object to be still by passing it to ##still-copy.  For example:<br>

<br>
> (define v (f32vector 1. 2. 3.))<br>
> (define v2 (##still-copy v))<br>
> (list v v2)<br>
(#f32(1. 2. 3.) #f32(1. 2. 3.))<br>
> (##still-copy (list 1 2 3))<br>
(1 2 3)<br>
<br>
Note that in the last call to ##still-copy, a still copy is only created for the pair at the head of the list.  In other words ##still-copy does a shallow copy.  If you want a deep copy you have to code it yourself.  That's why David said ##still-copy is less useful for lists.<br>

<br>
An alternative is to store the data as C data, and use the FFI to access it.  The difficulty level will depend on the data and how you manipulate it.<br>
<br>
If you want to allocate "constant Scheme data" the only option right now is to create a Scheme file like:<br>
<br>
(define my-constant-data '#f32(1.0 2.0 3.0))<br>
<br>
then compile the file with gsc and load the object file into your running application.<br>
<br>
I'm working on a solution for allocating constant data at run time, but it is low on my TODO list.<br><font color="#888888">
<br>
Marc<br>
<br>
</font></blockquote></div><br>