mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
Improve Rails4 performance by 20%, before the median on the page is 53ms, after it is 44ms
This commit is contained in:
parent
f13a408c2a
commit
46d5314ec4
1 changed files with 9 additions and 12 deletions
|
@ -231,30 +231,27 @@ module SiteSettingExtension
|
|||
|
||||
# trivial multi db support, we can optimize this later
|
||||
current[name] = current_value
|
||||
clean_name = name.to_s.sub("?", "")
|
||||
|
||||
setter = ("#{name}=").sub("?","")
|
||||
|
||||
eval "define_singleton_method :#{name} do
|
||||
eval "define_singleton_method :#{clean_name} do
|
||||
c = @@containers[provider.current_site]
|
||||
c = c[name] if c
|
||||
c
|
||||
end
|
||||
|
||||
define_singleton_method :#{setter} do |val|
|
||||
define_singleton_method :#{clean_name}? do
|
||||
c = @@containers[provider.current_site]
|
||||
c = c[name] if c
|
||||
c
|
||||
end
|
||||
|
||||
define_singleton_method :#{clean_name}= do |val|
|
||||
add_override!(:#{name}, val)
|
||||
refresh!
|
||||
end
|
||||
"
|
||||
end
|
||||
|
||||
def method_missing(method, *args, &block)
|
||||
as_question = method.to_s.gsub(/\?$/, '')
|
||||
if respond_to?(as_question)
|
||||
return send(as_question, *args, &block)
|
||||
end
|
||||
super(method, *args, &block)
|
||||
end
|
||||
|
||||
def enum_class(name)
|
||||
enums[name]
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue