1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activesupport/lib/active_support/json
Jeremy Kemper 864b92cd25 JSON: speed up date/time encoding
Comparing dates & times with other objects using #== is slow.
Internally, it hits #<=> which calls #to_datetime on objects
that don't respond to it, so we incur the cost of raising an
exception with a possibly-deep backtrace.

Cost of #jsonify on a Time object:

Calculating -------------------------------------
                 old      3644 i/100ms
                 new     12652 i/100ms
-------------------------------------------------
                 old    43373.8 (±3.5%) i/s -     218640 in   5.047017s
                 new   173437.6 (±5.2%) i/s -     872988 in   5.047747s
2013-12-11 23:32:33 -07:00
..
decoding.rb Moved AS::JSON::DATE_REGEX as it's only used for decoding 2013-11-06 17:15:18 -08:00
encoding.rb JSON: speed up date/time encoding 2013-12-11 23:32:33 -07:00