Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Ruby
[QUIZ] Weird Numbers (#57) Solution
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="James Edward Gray II, post: 4495149"] Just so others see the effect of this, here are some timings from runs. The first is Ryan's original code, the second is the new version's first (cache-less) run, and the third is the code taking advantage of the cache: Neo:~/Documents/Ruby/Ruby Quiz$ time ruby solutions/Ryan\ Leavengood/ weird_numbers.rb 50000 Weird numbers up to and including 50000: ... real 0m6.258s user 0m6.170s sys 0m0.046s Neo:~/Documents/Ruby/Ruby Quiz$ time ruby solutions/Ryan\ Leavengood/ weird_numbers.rb 50000 Weird numbers up to and including 50000: ... This took 6.231214 seconds real 0m6.253s user 0m6.169s sys 0m0.044s Neo:~/Documents/Ruby/Ruby Quiz$ time ruby solutions/Ryan\ Leavengood/ weird_numbers.rb 50000 Weird numbers up to and including 50000: ... This took 0.096576 seconds real 0m0.116s user 0m0.102s sys 0m0.011s James Edward Gray II [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Ruby
[QUIZ] Weird Numbers (#57) Solution
Top