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:
Yorick Peterse 2015-12-30 17:16:59 +01:00
parent 3077cb52d9
commit d3951dfaa1

View file

@ -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