aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/test/cases/serialization_test.rb
diff options
context:
space:
mode:
authorJonathan Hefner <jonathan@hefner.pro>2019-05-05 13:19:09 -0500
committerJonathan Hefner <jonathan@hefner.pro>2019-05-05 13:48:05 -0500
commit0e2de0e3fdc9a1fc763531b74e9fc49666022ff9 (patch)
tree283b765f796f0c2fe34715b400aa3e41ebc34929 /activemodel/test/cases/serialization_test.rb
parent9b0e632def6a66bbd0c0aba8531b2a173f7c3064 (diff)
downloadrails-0e2de0e3fdc9a1fc763531b74e9fc49666022ff9.tar.gz
rails-0e2de0e3fdc9a1fc763531b74e9fc49666022ff9.tar.bz2
rails-0e2de0e3fdc9a1fc763531b74e9fc49666022ff9.zip
Improve String#first and #last performance
Removes unnecessary conditional and method call for significant performance improvement. As a side effect, this fixes an unexpected behavior where passing a limit of 0 would return a frozen string. This also implements the Rails 6.1 intended behavior with regards to negative limits, and removes the previous deprecation warnings. String#first Comparison: new: 3056515.0 i/s old: 1943310.2 i/s - 1.57x slower String#last Comparison: new: 2691919.0 i/s old: 1924256.6 i/s - 1.40x slower (Note: "old" benchmarks have deprecation warnings commented out, for a more fair comparison.)
Diffstat (limited to 'activemodel/test/cases/serialization_test.rb')
0 files changed, 0 insertions, 0 deletions