[ANN] fastthread 0.4

M

MenTaLguY

--=-kPr4rus7PLehoTMBz+I6
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable


fastthread is a library which replaces the synchronization primitives
defined in stdlib=E2=80=99s thread.rb (Mutex, ConditionVariable, Queue, and
SizedQueue) with optimized versions which:

* are much faster (in the non-contention case, speed comparable to
direct use of Thread.critical or Thread.exclusive)
* don=E2=80=99t leak memory (the stdlib implementation of Mutex manag=
es to
trigger worst-case behavior of a memory leak in Array)

To use it, simply require 'fastthread' before you require 'thread'.
Provided you don=E2=80=99t muck with thread.rb=E2=80=99s internals, your co=
de should
work with no additional modification.

0.4 is primarily a robustness/bugfix release. There is both a gem and a
tarball available:

* http://moonbase.rydia.net/software/optimized-locking/fastthread-0.4=
gem
* http://moonbase.rydia.net/software/optimized-locking/fastthread-0.4=
tgz

-mental

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

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

iD8DBQBFZgimSuZBmZzm14ERAv/kAKDOVRoGgK4TTbmCTeV5oJk4RyGixACgi/TX
0uF3JysBu4rfvwFw0mEp5vE=
=NnDa
-----END PGP SIGNATURE-----

--=-kPr4rus7PLehoTMBz+I6--
 
F

Farrel Lifson

fastthread is a library which replaces the synchronization primitives
defined in stdlib's thread.rb (Mutex, ConditionVariable, Queue, and
SizedQueue) with optimized versions which:

* are much faster (in the non-contention case, speed comparable to
direct use of Thread.critical or Thread.exclusive)
* don't leak memory (the stdlib implementation of Mutex manages to
trigger worst-case behavior of a memory leak in Array)

To use it, simply require 'fastthread' before you require 'thread'.
Provided you don't muck with thread.rb's internals, your code should
work with no additional modification.

0.4 is primarily a robustness/bugfix release. There is both a gem and a
tarball available:

* http://moonbase.rydia.net/software/optimized-locking/fastthread-0.4.gem
* http://moonbase.rydia.net/software/optimized-locking/fastthread-0.4.tgz

-mental

Any chance this will be incorporated into the core libs?

Farrel
 
M

M. Edward (Ed) Borasky

Farrel said:
Any chance this will be incorporated into the core libs?

Farrel
Which "core libs"? The standard C implementation, jRuby or the Microsoft
CLR version? IIRC the jRuby team is going to or already is using the JVM
native threading model, and I have no idea what the Microsoft
implementors are doing, but I'm assuming they are building on the CLR
native threading model. And Ruby 1.9.x - 2.0 is supposedly going to use
native threads -- which presumably means at least Windows, Linux, MacOS
and Solaris. That pretty much leaves the 1.8.x C implementation.
 
M

MenTaLguY

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

Which "core libs"? The standard C implementation, jRuby or the Microsoft=20
CLR version? IIRC the jRuby team is going to or already is using the JVM=20
native threading model, and I have no idea what the Microsoft=20
implementors are doing, but I'm assuming they are building on the CLR=20
native threading model. And Ruby 1.9.x - 2.0 is supposedly going to use=20
native threads -- which presumably means at least Windows, Linux, MacOS=20
and Solaris. That pretty much leaves the 1.8.x C implementation.

That's about the shape of it. Once fastthread's seen some decent use in
production, I'll turn it into a patch and submit it for hopeful
inclusion in the 1.8.x stdlib.

I hope that the implementation of the thread.rb primitives on the other
Ruby implementations will be taken care of eventually. However, JRuby
uses the thread.rb from 1.8.x right now, which is kind of sad since
Thread.critical doesn't really work properly on JRuby. I wouldn't be
surprised if the same were true of the other implementations. Last I
looked, 1.9 was also more or less using a version of 1.8.x's thread.rb.

Frankly, the synchronization primitives in Ruby need a lot of help right
now on most or all of the implementations, and I'm trying to start the
ball rolling to get them fixed.

-mental

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

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

iD8DBQBFZnUNSuZBmZzm14ERAi6LAJwKAPwmcinh8QHWMDjUsiMDdM2FSQCfYoNp
cnuAkFK+rG4fBMmBDryixwo=
=hNr+
-----END PGP SIGNATURE-----

--=-/SIyqsdZNHTcC3wfMYSp--
 
M

M. Edward (Ed) Borasky

MenTaLguY said:
Frankly, the synchronization primitives in Ruby need a lot of help right
now on most or all of the implementations, and I'm trying to start the
ball rolling to get them fixed.

-mental
Good for you!! I'm betting jRuby gets cleaned up before the Microsoft
one does. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top