Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

Task: This week is about learning how to benchmark your code and explore how ruby versions speeds differ.

1)  git clone git@github.com:Tukaiz/dojo_2.git
2)  gem install benchmark and inline  *if you dont already have it*
3)  ruby factorial.rb then if you want ruby super_fast_factorial.rb
4)  find and compare everyones factorial methods and how fast they executed.
5)  use rvm *if you can and have it installed* compare Ruby 1.8.7 vs Ruby 1.9.2 you will see a difference in speed

Things to think about/discuss:

Notice that everyone had pretty much there "own" way to implement the factorial.

Remember: This is a GOOD thing! Coding should be more of an Art/Craft than a definitive thing we do.

Take are little example and answer these questions.
   Is the most clear and readable the fastest?
   Is what you thought would be the fastest is?
   Does changing the version of Ruby change the order of who's the fastest?

There are endless ways to compare and contrast code and not one way is correct all the time.

Just things that hopefully make you think differently about how you approached this problem.

I really found it cool to see how everyone solved this.

For me I was very impressed with people who added checks for valid Integers.
People who used "real" recursion and how readable and easy to follow some of your code was!

References:

https://rvm.beginrescueend.com/
http://www.ensta-paristech.fr/~diam/ruby/online/ruby-doc-stdlib/libdoc/benchmark/rdoc/index.html
http://www.zenspider.com/ZSS/Products/RubyInline/
http://programmingzen.com/2010/07/19/the-great-ruby-shootout-july-2010/

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

33 watching

Forks

Releases

Packages

Contributors

Languages