Add benchmark viewer

This commit is contained in:
Sam Doiron
2022-04-07 18:15:18 -03:00
parent c2b7b3df50
commit 45ddc00710
11 changed files with 283 additions and 32 deletions
BIN
View File
Binary file not shown.
+13 -5
View File
@@ -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