Don't use delegate to delegate trivial methods
Around 300 ms (in total) would be spent in these delegated methods due to the extra stuff ActiveSupport adds to the compiled methods. Because these delegations are so simple we can just manually define the methods, saving around 275 milliseconds.
This commit is contained in:
parent
3077cb52d9
commit
d3951dfaa1
1 changed files with 11 additions and 1 deletions
|
@ -47,7 +47,17 @@ module Banzai
|
|||
{ object_sym => LazyReference.new(object_class, node.attr(data_reference)) }
|
||||
end
|
||||
|
||||
delegate :object_class, :object_sym, :references_in, to: :class
|
||||
def object_class
|
||||
self.class.object_class
|
||||
end
|
||||
|
||||
def object_sym
|
||||
self.class.object_sym
|
||||
end
|
||||
|
||||
def references_in(*args, &block)
|
||||
self.class.references_in(*args, &block)
|
||||
end
|
||||
|
||||
def find_object(project, id)
|
||||
# Implement in child class
|
||||
|
|
Loading…
Reference in a new issue