mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-18 18:30:40 -07:00
Add benchmark viewer
This commit is contained in:
Vendored
BIN
Binary file not shown.
+13
-5
@@ -1,10 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'pry'
|
||||
require 'pry-byebug'
|
||||
|
||||
module Liquid
|
||||
class BlockBody
|
||||
def render_to_output_buffer(context, output)
|
||||
module CompileBlockBody
|
||||
def parse(*)
|
||||
super
|
||||
|
||||
ruby = +"->(__context, __output, __nodes) {\n"
|
||||
compile(ruby)
|
||||
ruby << "\n}"
|
||||
@@ -13,11 +15,13 @@ module Liquid
|
||||
hash[node.object_id] = node
|
||||
end
|
||||
|
||||
RubyVM::InstructionSequence
|
||||
@instructions = RubyVM::InstructionSequence
|
||||
.compile(ruby)
|
||||
.eval
|
||||
.call(context, output, nodes)
|
||||
end
|
||||
|
||||
def render_to_output_buffer(context, output)
|
||||
@instructions.call(context, output, nodes)
|
||||
output
|
||||
end
|
||||
|
||||
@@ -64,4 +68,8 @@ module Liquid
|
||||
ruby << "end\n"
|
||||
end
|
||||
end
|
||||
|
||||
class BlockBody
|
||||
include CompileBlockBody
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user