From: "Shot (Piotr Szotkowski)" Date: 2009-11-16T00:22:16+09:00 Subject: Re: Trajectories --wRRV7LY7NUeQGEoC Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Marnen Laibow-Koser: > James Edward Gray II wrote: >> If you put BigDecimal against Float, I'm pretty darn >> certain you will notice a very real speed difference. > Ruby 1.8.7p72 on Mac OS 10.6.1: > $ time ruby -rbigdecimal -e "1000.times{x =3D BigDecimal.new('3.5') * Big= Decimal.new('4.2')}" > real 0m0.009s > user 0m0.005s > sys 0m0.003s > $ time ruby -rbigdecimal -e "a =3D BigDecimal.new('3.5'); b =3D BigDecima= l.new('4.2'); 1000.times{x =3D a * b}" > real 0m0.007s > user 0m0.004s > sys 0m0.003s > $ time ruby -e "1000.times{x =3D 3.5 * 4.2}" > real 0m0.008s > user 0m0.004s > sys 0m0.004s > Looks darn close to me. When the time results are so small they don=E2=80=99t really mean anything: shot@devielle:~$ ruby -v ruby 1.9.1p243 (2009-07-16) [x86_64-linux] shot@devielle:~$ time ruby -rbigdecimal -e "10_000_000.times{x =3D BigDecim= al.new('3.5') * BigDecimal.new('4.2')}" real 0m50.280s user 0m47.719s sys 0m0.112s shot@devielle:~$ time ruby -rbigdecimal -e "a =3D BigDecimal.new('3.5'); b = =3D BigDecimal.new('4.2'); 10_000_000.times{x =3D a * b}" real 0m16.507s user 0m14.213s sys 0m0.020s shot@devielle:~$ time ruby -e "10_000_000.times{x =3D 3.5 * 4.2}" real 0m3.506s user 0m2.960s sys 0m0.008s =E2=80=94 Shot --=20 Those that could learn=C2=B9 did, and those that couldn=E2=80=99t learn=C2= =B2 were sufficiently cowed to shut the fsck up and leave the rest of us alone. =C2=B9 a surprisingly large fraction of the divisional workforce =C2=B2 an appallingly large fraction of the divisional workforce [Mike Andrews] --wRRV7LY7NUeQGEoC Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAksAHKEACgkQi/mCfdEo8UqvxgCdFG/iTZQgs9xmcM0Xu6QVf61O vnEAoJqYsEABRX2X27OSnwQtsu1OMDgj =FCQY -----END PGP SIGNATURE----- --wRRV7LY7NUeQGEoC--