Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > [ANN] fastthread 1.0

Reply
Thread Tools

[ANN] fastthread 1.0

 
 
MenTaLguY
Guest
Posts: n/a
 
      03-20-2007
--=-Gvz+QvI/3b4eVG08ZUuW
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

Well, just when I thought I was out of the fastthread business...

Okay, in brief:

fastthread is a Ruby extension which re-implements the primitives in
Ruby's thread.rb in C. It was merged into 1.8.6, replacing the old
thread.rb implementation, but the version that was merged had a couple
serious bugs.

So -- now I release fastthread 1.0, which is basically the Ruby 1.8.6
version with the fixes applied. You can use it as a hotfix for 1.8.6
until the next 1.8.x version is released, and of course it should still
work for speeding up older versions of 1.8 as well.

Gems and source are available via the mongrel RubyForge project:

http://rubyforge.org/frs/?group_id=3D1306

Let me know if you guys have any more problems.

-mental

--=-Gvz+QvI/3b4eVG08ZUuW
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

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

iD8DBQBF/2otSuZBmZzm14ERAuvOAJ9yuP+qds2n/ft2ZJTyYtud9dtAJACgkhqz
ml7EsUIaFKiOR24iaUg/XDs=
=CRkA
-----END PGP SIGNATURE-----

--=-Gvz+QvI/3b4eVG08ZUuW--

 
Reply With Quote
 
 
 
 
Jonas Pfenniger
Guest
Posts: n/a
 
      03-20-2007
2007/3/20, MenTaLguY <(E-Mail Removed)>:
> Well, just when I thought I was out of the fastthread business...
>
> Okay, in brief:
>
> fastthread is a Ruby extension which re-implements the primitives in
> Ruby's thread.rb in C. It was merged into 1.8.6, replacing the old
> thread.rb implementation, but the version that was merged had a couple
> serious bugs.
>
> So -- now I release fastthread 1.0, which is basically the Ruby 1.8.6
> version with the fixes applied. You can use it as a hotfix for 1.8.6
> until the next 1.8.x version is released, and of course it should still
> work for speeding up older versions of 1.8 as well.
>
> Gems and source are available via the mongrel RubyForge project:
>
> http://rubyforge.org/frs/?group_id=1306
>
> Let me know if you guys have any more problems.
>
> -mental


Hi Mental,

great stuff you've done here. Regarding 1.8.6, what happens if I
install fastthread and require it ? Will it be transparently ignored ?
All the code that I wrote ignores fastthread requires if it's not
installed. But I'd still like it to behave correctly in the case
fastthread is installed on 1.8.6.

--
Cheers,
zimbatm

 
Reply With Quote
 
 
 
 
Joel VanderWerf
Guest
Posts: n/a
 
      03-20-2007
MenTaLguY wrote:
> Well, just when I thought I was out of the fastthread business...
>
> Okay, in brief:
>
> fastthread is a Ruby extension which re-implements the primitives in
> Ruby's thread.rb in C. It was merged into 1.8.6, replacing the old
> thread.rb implementation, but the version that was merged had a couple
> serious bugs.
>
> So -- now I release fastthread 1.0, which is basically the Ruby 1.8.6
> version with the fixes applied. You can use it as a hotfix for 1.8.6
> until the next 1.8.x version is released, and of course it should still
> work for speeding up older versions of 1.8 as well.
>
> Gems and source are available via the mongrel RubyForge project:
>
> http://rubyforge.org/frs/?group_id=1306
>
> Let me know if you guys have any more problems.
>
> -mental


The hot fix installed ok and your tests pass, but compilation had a
(probably insignificant) warning:

fastthread.c: In function ‘wait_condvar’:
fastthread.c:626: warning: passing argument 1 of ‘rb_ensure’ from
incompatible pointer type

This is gcc 4.1.2 on linux.

Do you happen to have a test case that reproduces the problems in the
pre 1.0?

Is there something ruby code can easily do (easier than running the test
case, that is) to detect whether it is running with the patched
fastthread or the buggy one?

--
vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407

 
Reply With Quote
 
bbiker
Guest
Posts: n/a
 
      03-20-2007
On Mar 20, 12:59 am, MenTaLguY <(E-Mail Removed)> wrote:
> Well, just when I thought I was out of the fastthread business...
>
> Okay, in brief:
>
> fastthread is a Ruby extension which re-implements the primitives in
> Ruby's thread.rb in C. It was merged into 1.8.6, replacing the old
> thread.rb implementation, but the version that was merged had a couple
> serious bugs.
>
> So -- now I release fastthread 1.0, which is basically the Ruby 1.8.6
> version with the fixes applied. You can use it as a hotfix for 1.8.6
> until the next 1.8.x version is released, and of course it should still
> work for speeding up older versions of 1.8 as well.
>
> Gems and source are available via the mongrel RubyForge project:
>
> http://rubyforge.org/frs/?group_id=1306
>
> Let me know if you guys have any more problems.
>
> -mental
>
> signature.asc
> 1KDownload


Do you have or will have a version for mswin32?

I have VC 8 rather than VC 6

These are the resulting messages/
Building native extensions. This could take a while...
ERROR: While executing gem ... (Gem::Installer::ExtensionBuildError)
ERROR: Failed to build gem native extension.

ruby extconf.rb install fastthread
creating Makefile

nmake

Microsoft (R) Program Maintenance Utility Version 8.00.50727.762
Copyright (C) Microsoft Corporation. All rights reserved.

c:\ruby\bin\ruby -e "puts 'EXPORTS', 'Init_fastthread'" >
fastthread-i386-ms
win32.def
cl -nologo -I. -Ic:/ruby/lib/ruby/1.8/i386-mswin32 -Ic:/ruby/
lib/ruby/1.8/i38
6-mswin32 -I. -MD -Zi -O2b2xg- -G6 -c -Tcfastthread.c
cl : Command line warning D9035 : option 'Og-' has been deprecated and
will be remove
d in a future release
cl : Command line warning D9002 : ignoring unknown option '-G6'
fastthread.c
c:\ruby\lib\ruby\1.8\i386-mswin32\config.h(2) : fatal error C1189:
#error : MSC vers
ion unmatch
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio
8\VC\Bin\cl.EXE
"' : return code '0x2'
Stop.


Gem files will remain installed in c:/ruby/lib/ruby/gems/1.8/gems/
fastthread-1.0 for
inspection.
Results logged to c:/ruby/lib/ruby/gems/1.8/gems/fastthread-1.0/ext/
fastthread/gem_ma
ke.out



 
Reply With Quote
 
MenTaLguY
Guest
Posts: n/a
 
      03-20-2007
--=-nsGXwKydz+56QqDs/tHg
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

On Tue, 2007-03-20 at 23:22 +0900, Jonas Pfenniger wrote:
> great stuff you've done here. Regarding 1.8.6, what happens if I
> install fastthread and require it ? Will it be transparently ignored ?


No, fastthread will get used in that case (which is probably what you
want, given that fastthread fixes bugs in 1.8.6).

> All the code that I wrote ignores fastthread requires if it's not
> installed. But I'd still like it to behave correctly in the case
> fastthread is installed on 1.8.6.


You shouldn't need to make any changes at this point. Use fastthread if
it is installed. If there's a version of Ruby it's not appropriate for,
I'll try to set the version requirements for the gem accordingly.

-mental

--=-nsGXwKydz+56QqDs/tHg
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

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

iD8DBQBGAGkSSuZBmZzm14ERAmA5AKDb0mGDGlprqTyQJlgGCS B8B/1tlwCcDju1
QlQiYE4KleAo6LP5qWQv5c4=
=e7vL
-----END PGP SIGNATURE-----

--=-nsGXwKydz+56QqDs/tHg--

 
Reply With Quote
 
MenTaLguY
Guest
Posts: n/a
 
      03-20-2007
--=-NuvcNRti0PW6Ne9jDnuk
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On Tue, 2007-03-20 at 23:42 +0900, Joel VanderWerf wrote:
> fastthread.c: In function =E2=80=98wait_condvar=E2=80=99:
> fastthread.c:626: warning: passing argument 1 of =E2=80=98rb_ensure=E2=80=

=99 from=20
> incompatible pointer type


Yes, that's harmless in this case.

> Do you happen to have a test case that reproduces the problems in the=20
> pre 1.0?


Not offhand. I think some of the tests which were added to ruby_1_8
cover the problems though.

> Is there something ruby code can easily do (easier than running the test=20
> case, that is) to detect whether it is running with the patched=20
> fastthread or the buggy one?


The best thing to do is simply to require fastthread if it is available:

begin
require 'fastthread'
rescue LoadError
end

The fastthread built into 1.8.6 is just "thread".

-mental

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

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

iD8DBQBGAGnXSuZBmZzm14ERAh+eAKDXa1Pn1+mGItNuCvMJPy q1OBNdAgCgyY3p
/nQotmau31vIIypsp842NIw=
=ttf1
-----END PGP SIGNATURE-----

--=-NuvcNRti0PW6Ne9jDnuk--

 
Reply With Quote
 
MenTaLguY
Guest
Posts: n/a
 
      03-20-2007
--=-tQAKAgo26mFNN+HRRg5e
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

Well, to be clear you should always be requiring 'thread' too. So the
very best practice with fastthread is this:

require 'thread'
begin
require 'fastthread'
rescue LoadError
end
=20
i.e. simply add an optional fastthread require wherever you require
thread.

-mental

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

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

iD8DBQBGAG20SuZBmZzm14ERAvgRAKDGUf76JVHW19qh+v49DB in5i+w/gCg2exS
ek6LHFIk1cCIEtmxpaGSXbk=
=AVDr
-----END PGP SIGNATURE-----

--=-tQAKAgo26mFNN+HRRg5e--

 
Reply With Quote
 
MenTaLguY
Guest
Posts: n/a
 
      03-20-2007
--=-lK+StVQPg4f+BM0ePLzD
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

On Wed, 2007-03-21 at 06:45 +0900, bbiker wrote:
> Do you have or will have a version for mswin32?


One should eventually be available. Unfortunately I do not have the
capability to build win32 gems myself; this is usually handled by Luis
Lavena of the Mongrel project. Hopefully he will have time to do so
soon.

As far as the VC6 versus VC8 thing goes, as far as I know the gem needs
to be built with the same version of VC as Ruby was built with. (it
sounds like your Ruby may have been built with VC6)

-mental


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

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

iD8DBQBGAG5+SuZBmZzm14ERAgl4AJ0dZz+20IK7HzFiBpC2zb 6RV0lc8gCdF7Tx
8GmR8BOuBa8ILn7ihKK29XY=
=Rgg2
-----END PGP SIGNATURE-----

--=-lK+StVQPg4f+BM0ePLzD--

 
Reply With Quote
 
Dan Teitsort
Guest
Posts: n/a
 
      05-29-2007
MenTaLguY wrote:
> Well, to be clear you should always be requiring 'thread' too.


That got me thinking, and I eventually concluded the recommended
practice should be:

Do this:

require 'thread'
begin
require 'fastthread'
rescue LoadError
end

BEFORE you require 'thread' or anything that might indirectly
require
'thread' (e.g., drb).


If one just did a require 'fastthread', then a subsequent require
'thread' would undo it.

If messed up and did the "require 'thread' ... require 'fastthread'..."
AFTER requiring a file that did its own require 'thread', then there
would be a chance something in the interim used the un-augmented
'thread'.

The safest thing, it seems to me, is to do the "require
'thread'....require 'fastthread'..." business at the very begining of
one's application, if there's a chance 'thread' is used anywhere.

All bets are off if "load" is used to directly or indirectly load
thread.rb. Surely nobody does that

Of course, I could be missing something here. Thoughts?

--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
MenTaLguY
Guest
Posts: n/a
 
      05-30-2007
--=-lRPe+WqqY1WIrTO9wOKw
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

On Wed, 2007-05-30 at 08:16 +0900, Dan Teitsort wrote:
> If one just did a require 'fastthread', then a subsequent require=20
> 'thread' would undo it.


fastthread does require 'thread' itself, so that shouldn't be a problem.

-mental

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

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

iD8DBQBGXOcPSuZBmZzm14ERAkhoAJsGFXd5U4skgxHjg8RP6+ Fvu+12PgCgqo/u
XIs8EEEpRl4H4VhWdRQyclo=
=83Sr
-----END PGP SIGNATURE-----

--=-lRPe+WqqY1WIrTO9wOKw--

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[ANN] fastthread-0.6.4.1 released MenTaLguY Ruby 0 02-14-2007 11:28 PM
[ANN] fastthread now default in ruby_1_8 Akinori MUSHA Ruby 0 02-10-2007 10:00 PM
[ANN] fastthread-0.6.3 MenTaLguY Ruby 1 01-31-2007 08:17 PM
[ANN] fastthread 0.6.2 MenTaLguY Ruby 4 01-19-2007 05:48 PM
[ANN] fastthread 0.4 MenTaLguY Ruby 4 11-24-2006 06:56 AM



Advertisments