[elephant-devel] Optimization

Elliott Slaughter elliottslaughter at gmail.com
Sun Dec 28 07:05:39 UTC 2008


There are several replies to my original query, so I will attempt to address
all of them here.

On Wed, Dec 24, 2008 at 2:31 PM, Ian Eslick <eslick at media.mit.edu> wrote:

> A couple of quick thoughts on your problem:
>
> 1) Are you wrapping the critical sections of your code in with-
> transaction?  This causes all database pages you touch to be cached
> within the body of the transaction.  This avoids all 'sync' operations
> and transaction setup/teardown caused by a read/write slot operation
> that takes place outside a with-transaction body.


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.

Wrapping the entire game loop in with-transaction increases performance by
about 10%. I also tried

(db-env-set-flags (controller-environment *store-controller*) 1 :txn-nosync
t)

as suggested in the manual, with a similar (about 10%) performance increase.

2) If you are doing this, have you increased your BDB cache size to
> ensure you can cache your key working set?


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%.

3) If yes, do you have significant contention between reads and writes
> for certain data structures that are causing transactions to be
> aborted.  Perhaps you can refactor around this.


This is a single-threaded (and single-process) app. I don't see how I could
possibly have contention for the db.

Ian
>

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).


Thanks again for all the help. I'll report back either when I have something
working or I've run into another wall.

-- 
Elliott Slaughter

"Any road followed precisely to its end leads precisely nowhere." - Frank
Herbert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/elephant-devel/attachments/20081227/61501886/attachment.html>


More information about the elephant-devel mailing list