diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2013-12-11 23:25:17 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2013-12-11 23:32:33 -0700 |
commit | 864b92cd25d70bb623d43dbe3b28488c93885e61 (patch) | |
tree | dea314ae5268ffa452d1a91a0da395c5501c875c /guides/Rakefile | |
parent | ebfd97124db0cd7550dd197559343e2fda5b79d6 (diff) | |
download | rails-864b92cd25d70bb623d43dbe3b28488c93885e61.tar.gz rails-864b92cd25d70bb623d43dbe3b28488c93885e61.tar.bz2 rails-864b92cd25d70bb623d43dbe3b28488c93885e61.zip |
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
Diffstat (limited to 'guides/Rakefile')
0 files changed, 0 insertions, 0 deletions