mirror of
https://github.com/discourse/discourse.git
synced 2025-03-06 11:19:51 +00:00
DEV: include comment explaining monkey patch
The monkey patch here is very surprising, make a comment explaining why it is used in the code. see: https://github.com/rails/rails/issues/35059 for upstream tracking
This commit is contained in:
parent
47dbf54960
commit
a72ed6278b
@ -1,6 +1,16 @@
|
|||||||
# perf fixes, review for each rails upgrade.
|
# perf fixes, review for each rails upgrade.
|
||||||
|
|
||||||
# we call this a lot
|
# This speeds up calls to present? and blank? on model instances
|
||||||
|
# Eg: Topic.new.blank? (which is always false) and so on.
|
||||||
|
#
|
||||||
|
# Per: https://gist.github.com/SamSaffron/c8bbc8c7b6bf3b0148760c887df18b55
|
||||||
|
# Comparison:
|
||||||
|
# fast present: 25253295.0 i/s
|
||||||
|
# fast present 2: 24623199.7 i/s - same-ish: difference falls within error
|
||||||
|
# slow present: 335003.0 i/s - 75.38x slower
|
||||||
|
# slow present 2: 275212.8 i/s - 91.76x slower
|
||||||
|
#
|
||||||
|
# raised with rails at: https://github.com/rails/rails/issues/35059
|
||||||
class ActiveRecord::Base
|
class ActiveRecord::Base
|
||||||
def present?
|
def present?
|
||||||
true
|
true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user