On 9/13/07, Greg Ewing <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > what if ... we use atomic test-and-set to > > handle reference counting (with a lock for those CPU architectures where we > > haven't written the necessary assembler fragment), then implement a lock for > > each mutable type and another for global state (thread state, interpreter > > state, etc)? > > Could be worth a try. A first step might be to just implement > the atomic refcounting, and run that single-threaded to see > if it has terribly bad effects on performance.
I've done this experiment. It was about 12% on my box. Later, once I had everything else setup so I could run two threads simultaneously, I found much worse costs. All those literals become shared objects that create contention. I'm now working on an approach that writes out refcounts in batches to reduce contention. The initial cost is much higher, but it scales better too. I've currently got it to just under 50% cost, meaning two threads is a slight net gain. -- Adam Olsen, aka Rhamphoryncus _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com