From: John Carter Date: 2007-07-18T10:32:10+09:00 Subject: Re: Spin buffers On Wed, 18 Jul 2007, MenTaLguY wrote: And yes... I did, as always, measure before I optimized and my Queue of Array trick did speed things measurably. > Depends on the version of Ruby. It certainly is if you're using > fastthread. If he's not using fastthread, I'd recommend giving it a > try. I'm not using fastthread since it caused code that had been working fine for several years to curl up and die. So I disabled it. I'll admit I never got to the bottom of why it did.... (and no, it wasn't the code that used my queue of arrays trick) >>> This "Spin Buffer" trick looks Good... >>> http://www.ddj.com/dept/architect/199902669?pgno=2 >>> >>> Anyone have a ruby Spin Buffer implementation lying around? > "Spin Buffers" are _snake oil_; they get their "speed" at the expense of > correctness -- the implementation given in the DDJ article is not > threadsafe. Well that was a bit of a problem with the article... it didn't actually include the code so I can't say one way or the other on that. Any pointers as to what the incorrect bit is? John Carter Phone : (64)(3) 358 6639 Tait Electronics Fax : (64)(3) 359 4632 PO Box 1645 Christchurch Email : john.carter@tait.co.nz New Zealand