From d7a40ec4708e77d01f29d6cdd1a2054b8b51f48d Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Fri, 21 Mar 2014 17:45:23 +0100 Subject: [PATCH] Simple benchmark for lexing elements. --- benchmark/lexer/bench_element.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 benchmark/lexer/bench_element.rb diff --git a/benchmark/lexer/bench_element.rb b/benchmark/lexer/bench_element.rb new file mode 100644 index 0000000..ed3c760 --- /dev/null +++ b/benchmark/lexer/bench_element.rb @@ -0,0 +1,21 @@ +require_relative '../../lib/oga' +require 'benchmark/ips' + +simple = '

Hello world

' +attributes = '

Hello world

' +nested = '

Helloworld

' +lexer = Oga::Lexer.new + +Benchmark.ips do |bench| + bench.report 'text only' do + lexer.lex(simple) + end + + bench.report 'text + attributes' do + lexer.lex(attributes) + end + + bench.report 'text + children' do + lexer.lex(nested) + end +end