--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 = BigDecimal.new('3.5') * BigDecimal.new('4.2')}"
> real    0m0.009s
> user    0m0.005s
> sys     0m0.003s

> $ time ruby -rbigdecimal -e "a = BigDecimal.new('3.5'); b = BigDecimal.new('4.2'); 1000.times{x = a * b}"
> real    0m0.007s
> user    0m0.004s
> sys     0m0.003s

> $ time ruby -e "1000.times{x = 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 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 = BigDecimal.new('3.5') * BigDecimal.new('4.2')}"
real  0m50.280s
user  0m47.719s
sys   0m0.112s

shot@devielle:~$ time ruby -rbigdecimal -e "a = BigDecimal.new('3.5'); b = BigDecimal.new('4.2'); 10_000_000.times{x = a * b}"
real  0m16.507s
user  0m14.213s
sys   0m0.020s

shot@devielle:~$ time ruby -e "10_000_000.times{x = 3.5 * 4.2}"
real  0m3.506s
user  0m2.960s
sys   0m0.008s

Shot
-- 
Those that could learn did, and those that couldn”Ēt learn were
sufficiently cowed to shut the fsck up and leave the rest of us alone.
 a surprisingly large fraction of the divisional workforce
 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
Y
-----END PGP SIGNATURE-----

--wRRV7LY7NUeQGEoC--