diff options
author | Godfrey Chan <godfreykfc@gmail.com> | 2014-11-17 17:58:49 -0800 |
---|---|---|
committer | Godfrey Chan <godfreykfc@gmail.com> | 2014-11-17 17:58:49 -0800 |
commit | 6f7910aed5ceeb8833de760f396858bee917c7bc (patch) | |
tree | ffce3edf9c159cfec96371a544b8ababd94097ea /.yardopts | |
parent | eb26f24bde62cbbcd8ef0e7ee9c64060b098baff (diff) | |
download | rails-6f7910aed5ceeb8833de760f396858bee917c7bc.tar.gz rails-6f7910aed5ceeb8833de760f396858bee917c7bc.tar.bz2 rails-6f7910aed5ceeb8833de760f396858bee917c7bc.zip |
[PERF] Speed up integer type casting from DB
We don't have the check the range when the value is coming from the DB, so
override type_cast_from_database to short-circuit the extra work.
type_cast_from_database (small) 3437507.5 (±29.2%) i/s - 14223135 in 4.996973s
type_cast_from_database (large) 3158588.7 (±28.3%) i/s - 13265628 in 4.992121s
type_cast (small) 481984.8 (±14.2%) i/s - 2352012 in 5.005694s
type_cast (large) 477331.8 (±14.2%) i/s - 2332824 in 5.012365s
Comparison:
type_cast_from_database (small): 3437507.5 i/s
type_cast_from_database (large): 3158588.7 i/s - 1.09x slower
type_cast (small): 481984.8 i/s - 7.13x slower
type_cast (large): 477331.8 i/s - 7.20x slower
The difference is huge but the absolute gain is quite small. That being said
this is a hotspot and it showed up on the radar when benchmarking discourse.
Diffstat (limited to '.yardopts')
0 files changed, 0 insertions, 0 deletions