[elephant-devel] Optimization
Ian Eslick
eslick at media.mit.edu
Wed Dec 24 22:31:53 UTC 2008
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.
2) If you are doing this, have you increased your BDB cache size to
ensure you can cache your key working set?
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.
Ian
On Dec 23, 2008, at 4:22 AM, Leslie P. Polzer wrote:
>
> Dear Elliott,
>
> On Sun, Dec 21, 2008 at 09:35:06PM -0800, Elliott Slaughter wrote:
>
>> I am exploring Elephant/BDB as a backend for a video game I am
>> writing. I
>> have ignored performance considerations so far, but on some larger
>> maps
>> (around 100 objects), performance is abominably slow (around 5
>> fps). The
>> same maps run about 10 times faster (about 50 fps) when using
>> completely
>> in-memory hash-tables.
>>
>> Based on profiling, it appears that the main bottleneck is
>> persistent slot
>> lookup. I remember reading that Elephant reads from file on every
>> slot read,
>> which could explain this result.
>
> I can confirm this (symptoms and cause).
>
> Luckily I have only one code path right now that is heavy
> enough to be a performance problem, and I can work around it using
> my own caching mechanism.
>
> When your program is single-threaded then you might be able
> to pull off something similar.
>
> Search for "dynamic scope memoization" on comp.lang.lisp.
>
> Leslie
>
> _______________________________________________
> elephant-devel site list
> elephant-devel at common-lisp.net
> http://common-lisp.net/mailman/listinfo/elephant-devel
More information about the elephant-devel
mailing list