--=-ZlOe4R5VzxuVmabsp2AU
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

On Mon, 2007-07-16 at 14:30 +0900, Robert Klemme wrote:
> What exactly makes you believe that?  Can you show some code and / or=20
> figures that back this theory?

Seconded.  Measure first, then optimize.

> > I hacked around it by creating a Queue of Arrays, but that probably
> > creates more garbage than I should.

That probably performs slower than Queue.

> Difficult to say without seeing the code.  Generally I'd say that Queue=20
> is pretty efficient already since it's implemented in C AFAIR.

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.

> > This "Spin Buffer" trick looks Good...
> >   http://www.ddj.com/dept/architect/199902669?pgno=3D2
> >=20
> > 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.  If it were rewritten to be threadsafe, it would actually be
slower than some simpler alternatives.

-mental

--=-ZlOe4R5VzxuVmabsp2AU
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQBGnWVbSuZBmZzm14ERAuaXAKCDvGoK7xn9g6HtUKZvIfdK21GENwCeN+FG
4b+yQIZLYbr/uaNmjYfsQgI=
=1Ih5
-----END PGP SIGNATURE-----

--=-ZlOe4R5VzxuVmabsp2AU--