Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring code #169

Open
dukaev opened this issue Feb 13, 2019 · 1 comment
Open

Refactoring code #169

dukaev opened this issue Feb 13, 2019 · 1 comment

Comments

@dukaev
Copy link

dukaev commented Feb 13, 2019

I noticed that many examples in code/ do not match the template.

require "benchmark/ips"

def fast
end

def slow
end

Benchmark.ips do |x|
  x.report("fast code description") { fast }
  x.report("slow code description") { slow }
  x.compare!
end
@ashwinisukale
Copy link

I found following code examples where we are not following the template

https://github.com/fastruby/fast-ruby/blob/main/code/enumerable/sort-vs-sort_by.rb - Here instead of faster and fastest, can we say fast and faster

https://github.com/fastruby/fast-ruby/blob/main/code/hash/keys-include-vs-key.rb - Can we change method name to slow and faster, as we are following same template for all our examples

https://github.com/fastruby/fast-ruby/blob/main/code/hash/values-include-vs-value.rb - Can we change method name to slow and faster, as we are following same template for all our examples

https://github.com/fastruby/fast-ruby/blob/main/code/method/call-vs-send-vs-method_missing.rb - Instead of fastest, rename to fast

https://github.com/fastruby/fast-ruby/blob/main/code/proc-and-block/proc-call-vs-yield.rb - can we rename slow1, slow2 etc to what actually that method is doing

https://github.com/fastruby/fast-ruby/blob/main/code/string/mutable_vs_immutable_strings.rb - specify which is slower and faster, as per the template we follow in all examples

https://github.com/fastruby/fast-ruby/blob/main/code/string/sub!-vs-gsub!-vs-%5B%5D%3D.rb - Can we change name from slow_1 to what method is eg slow_sub

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants