You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I checked to make sure that this issue has not already been filed
I'm reporting the issue to the correct repository (for multi-repository projects)
Branch/Commit:
Main branch.
Expected behavior:
Comparison sharing for this snippet should just work:
require 'benchmark/ips'
NUM = 1.12678.freeze
def fast
NUM.round(2).to_s
end
def avg
format('%.2f', NUM)
end
def slow
'%.2f' % NUM
end
Benchmark.ips do |x|
x.report('Float#round') { fast }
x.report('Kernel#format') { avg }
x.report('String#%') { slow }
x.compare!
end
Actual behavior:
It raises a ActionController::BadRequest (Invalid request parameters: invalid %-encoding) error.
Before we start...:
Branch/Commit:
Main branch.
Expected behavior:
Comparison sharing for this snippet should just work:
Actual behavior:
It raises a ActionController::BadRequest (Invalid request parameters: invalid %-encoding) error.
Steps to reproduce:
git clone [email protected]:fastruby/fast-ruby.git
cd fast-ruby
bundle
SHARE=1 bundle exec ruby -v code/general/format-vs-round-and-to-s.rb
Logs
Client log:
Server log:
I will abide by the code of conduct
The text was updated successfully, but these errors were encountered: