It looks like I got too creative in 0.6.1 and consequently ran afoul of a bug in the Ruby interpreter. 0.6.2 works around the bug and should be entirely stable at this point. Thanks to Young Hyun for his help in coming up with test cases. == what? fastthread is a Ruby library which provides a faster (and non-memory-leaking) C implementation of the concurrency primitives from stdlib''s thread.rb. It aims to be 100% compatible with thread.rb''s public API. So, how much faster? In the single-threaded case, fastthread''s version of Mutex#lock and Mutex#synchronize are comparable in performance to Thread.critical= and Thread.exclusive. With multiple threads, it has an additional advantage over Thread.critical in that entering a critical section doesn''t suspend any other threads unless they''re competing for the same lock. (Compare that to Thread.critical, which stops all other threads dead!) I know a lot of folks have been avoiding stdlib''s Mutex because all the method calls killed performance. But no more, with fastthread! Why use Thread.critical when you can use the real thing? == how? Simply require ''fastthread'' in addition to ''thread''. If you want to make fastthread optional (recommended!), do it this way: require ''thread'' begin require ''fastthread'' rescue LoadError end This way, your program will still work on systems that don''t have (or don''t need -- e.g. JRuby) fastthread, but you still get a performance boost on systems where it''s available. == where? Gem: http://moonbase.rydia.net/software/optimized-locking/fastthread-0.6.2.gem Tarball: http://moonbase.rydia.net/software/optimized-locking/fastthread-0.6.2.tgz fastthread is also available on Rubyforge (and therefore the main gems repository), courtesy of the Mongrel project: https://rubyforge.org/frs/?group_id=1306 -mental -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part Url : http://rubyforge.org/pipermail/mongrel-users/attachments/20070118/a16cfbd6/attachment.bin
Sorry, for those of us that don''t know, how does this relate to Mongrel? I''m not really clear on that from your message. Sounds cool though. On Jan 18, 2007, at 4:51 PM, MenTaLguY wrote:> It looks like I got too creative in 0.6.1 and consequently ran > afoul of > a bug in the Ruby interpreter. 0.6.2 works around the bug and > should be > entirely stable at this point. > > Thanks to Young Hyun for his help in coming up with test cases. > > == what? > > fastthread is a Ruby library which provides a faster (and > non-memory-leaking) C implementation of the concurrency primitives > from > stdlib''s thread.rb. It aims to be 100% compatible with thread.rb''s > public API. > > So, how much faster? In the single-threaded case, fastthread''s > version > of Mutex#lock and Mutex#synchronize are comparable in performance to > Thread.critical= and Thread.exclusive. With multiple threads, it > has an > additional advantage over Thread.critical in that entering a critical > section doesn''t suspend any other threads unless they''re competing for > the same lock. (Compare that to Thread.critical, which stops all > other > threads dead!) > > I know a lot of folks have been avoiding stdlib''s Mutex because all > the > method calls killed performance. But no more, with fastthread! > Why use > Thread.critical when you can use the real thing? > > == how? > > Simply require ''fastthread'' in addition to ''thread''. If you want to > make fastthread optional (recommended!), do it this way: > > require ''thread'' > begin > require ''fastthread'' > rescue LoadError > end > > This way, your program will still work on systems that don''t have (or > don''t need -- e.g. JRuby) fastthread, but you still get a performance > boost on systems where it''s available. > > == where? > > Gem: > http://moonbase.rydia.net/software/optimized-locking/ > fastthread-0.6.2.gem > > Tarball: > http://moonbase.rydia.net/software/optimized-locking/ > fastthread-0.6.2.tgz > > fastthread is also available on Rubyforge (and therefore the main gems > repository), courtesy of the Mongrel project: > > https://rubyforge.org/frs/?group_id=1306 > > -mental > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users
On Jan 18, 2007, at 5:02 PM, Hunter Hillegas wrote:> Sorry, for those of us that don''t know, how does this relate to > Mongrel? > > I''m not really clear on that from your message. > > Sounds cool though. >Hi Hunter, Read the following http://rubyforge.org/pipermail/mongrel-users/2007-January/002645.html Regards, Jason
On 1/18/07, Hunter Hillegas <lists at lastonepicked.com> wrote:> Sorry, for those of us that don''t know, how does this relate to Mongrel? > > I''m not really clear on that from your message. > > Sounds cool though. >Fastthread is used in Mongrel, I believe, to avoid some memory leaks w/i Ruby.
On Thu, 2007-01-18 at 17:02 -0800, Hunter Hillegas wrote:> Sorry, for those of us that don''t know, how does this relate to Mongrel? > > I''m not really clear on that from your message.fastthread resolves the memory problems that Mongrel has when using stdlib''s Mutex. It''s actually a dependency for the Mongrel gem now. -mental -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part Url : http://rubyforge.org/pipermail/mongrel-users/attachments/20070118/f2134a21/attachment.bin
Got it, thanks. So, we should upgrade our fastthread to your latest version then, right? On Jan 18, 2007, at 5:16 PM, MenTaLguY wrote:>> Sorry, for those of us that don''t know, how does this relate to >> Mongrel? >> >> I''m not really clear on that from your message. > > fastthread resolves the memory problems that Mongrel has when using > stdlib''s Mutex. It''s actually a dependency for the Mongrel gem now. > > -mental > __________
Thanks Jason, I missed that the first time around. Hunter On Jan 18, 2007, at 5:10 PM, Jason A. Hoffman wrote:> > On Jan 18, 2007, at 5:02 PM, Hunter Hillegas wrote: > >> Sorry, for those of us that don''t know, how does this relate to >> Mongrel? >> >> I''m not really clear on that from your message. >> >> Sounds cool though. >> > > Hi Hunter, > > Read the following > > http://rubyforge.org/pipermail/mongrel-users/2007-January/002645.html > > Regards, Jason > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users
On Thu, 2007-01-18 at 17:28 -0800, Hunter Hillegas wrote:> Got it, thanks. So, we should upgrade our fastthread to your latest > version then, right?Highly, highly recommended, yes. Versions earlier than 0.6 won''t work with the newest RubyGems, and 0.6.2 is the first really stable 0.6.x. -mental -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part Url : http://rubyforge.org/pipermail/mongrel-users/attachments/20070118/897fd31c/attachment.bin