<div class="gmail_quote">There are several replies to my original query, so I will attempt to address all of them here.</div><div class="gmail_quote"><br></div><div class="gmail_quote">On Wed, Dec 24, 2008 at 2:31 PM, Ian Eslick <span dir="ltr"><<a href="mailto:eslick@media.mit.edu" target="_blank">eslick@media.mit.edu</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
A couple of quick thoughts on your problem:<br>
<br>
1) Are you wrapping the critical sections of your code in with-<br>
transaction?  This causes all database pages you touch to be cached<br>
within the body of the transaction.  This avoids all 'sync' operations<br>
and transaction setup/teardown caused by a read/write slot operation<br>
that takes place outside a with-transaction body.</blockquote><div><br></div><div>I currently wrap the contents of each frame update in with-transaction. Each frame consists of updating 100 objects on the screen (which by my estimation ought to be about 20 slot reads and 2 writes), so I ought to be doing about 2000 slot reads each frame and 200 writes.</div>

<div><br></div><div>Wrapping the entire game loop in with-transaction increases performance by about 10%. I also tried</div><br>(db-env-set-flags (controller-environment *store-controller*) 1 :txn-nosync t)</div><div class="gmail_quote">
<br></div><div class="gmail_quote">as suggested in the manual, with a similar (about 10%) performance increase.<br><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


2) If you are doing this, have you increased your BDB cache size to<br>
ensure you can cache your key working set?</blockquote><div><br></div><div>It should already be large enough, but just for kicks I increased it from 2 to 10 MB, resulting in a performance increase of about 3%.</div><div>
<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

3) If yes, do you have significant contention between reads and writes<br>
for certain data structures that are causing transactions to be<br>
aborted.  Perhaps you can refactor around this.</blockquote><div><br></div><div>This is a single-threaded (and single-process) app. I don't see how I could possibly have contention for the db.</div><div><br></div><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">
Ian<br></blockquote><div><br></div><div>And thanks to both Leslie and Alex for suggesting caching methods. I will probably try to implement something along the lines of Alex's suggestion, as that makes sense and should be simple enough (for the single threaded model, which is sufficient for me).</div>
</div><div><br></div><div><br></div><div>Thanks again for all the help. I'll report back either when I have something working or I've run into another wall.</div><br>-- <br>Elliott Slaughter<br><br>"Any road followed precisely to its end leads precisely nowhere." - Frank Herbert<br>