From 9dfdefee47882d915e4e94bcfaba9de4fc155d61 Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Thu, 1 May 2014 22:59:56 +0200 Subject: [PATCH] Removed XML::Lexer#buffering? Instead of wrapping a predicate method around the ivar we'll just access it directly. This reduces average lexing times in the big XML benchmark from 7,5 to ~7 seconds. --- lib/oga/xml/lexer.rl | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/lib/oga/xml/lexer.rl b/lib/oga/xml/lexer.rl index fa55225..eb4215b 100644 --- a/lib/oga/xml/lexer.rl +++ b/lib/oga/xml/lexer.rl @@ -215,15 +215,6 @@ module Oga @buffer_start_position = position end - ## - # Returns `true` if we're currently buffering. - # - # @return [TrueClass|FalseClass] - # - def buffering? - return !!@buffer_start_position - end - ## # Emits the current buffer if we have any. The current line number is # advanced based on the amount of newlines in the buffer. @@ -538,7 +529,7 @@ module Oga # will otherwise take precedence over the other rules. any => { # First character, start buffering (unless we already are buffering). - start_buffer(ts) unless buffering? + start_buffer(ts) unless @buffer_start_position # EOF, emit the text buffer. if te == eof