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.
This commit is contained in:
parent
b854f737cd
commit
9dfdefee47
|
@ -215,15 +215,6 @@ module Oga
|
||||||
@buffer_start_position = position
|
@buffer_start_position = position
|
||||||
end
|
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
|
# Emits the current buffer if we have any. The current line number is
|
||||||
# advanced based on the amount of newlines in the buffer.
|
# advanced based on the amount of newlines in the buffer.
|
||||||
|
@ -538,7 +529,7 @@ module Oga
|
||||||
# will otherwise take precedence over the other rules.
|
# will otherwise take precedence over the other rules.
|
||||||
any => {
|
any => {
|
||||||
# First character, start buffering (unless we already are buffering).
|
# 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.
|
# EOF, emit the text buffer.
|
||||||
if te == eof
|
if te == eof
|
||||||
|
|
Loading…
Reference in New Issue