Actions
Feature #13827
closedImprove performance of `Base64.urlsafe_encode64`
Feature #13827:
Improve performance of `Base64.urlsafe_encode64`
Status:
Closed
Assignee:
-
Target version:
-
Description
Improve performance of Base64.urlsafe_encode64 by avoiding unnecessary memory allocations. This may seem insignificant, but for the web service I am working on this patch makes noticeable improvement.
Benchmark¶
require 'benchmark/ips'
require 'base64'
require 'securerandom'
Benchmark.ips do |x|
string = SecureRandom.bytes(128)
x.report 'Base64.urlsafe_encode64' do |t|
t.times { Base64.urlsafe_encode64(string) }
end
end
Before¶
After¶
Patch¶
Updated by jeremyevans0 (Jeremy Evans) about 7 years ago
- Tracker changed from Bug to Feature
- Backport deleted (
2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN)
Updated by mame (Yusuke Endoh) almost 7 years ago
- Status changed from Open to Closed
Merged at 1bdabaa6b13344c195698ca5b0ced323cb93e2e1. Thank you for the contribution.
Actions