diff options
| author | aycabta <aycabta@gmail.com> | 2021-01-26 13:18:05 +0900 |
|---|---|---|
| committer | aycabta <aycabta@gmail.com> | 2021-02-07 05:09:18 +0900 |
| commit | b69c965f477af1b2eb883137b3df9da8fca7b616 (patch) | |
| tree | 227955ddb06bbec747fab8a73787e535c24fc677 /spec/ruby/core | |
| parent | 132e01a1c3ada1fe31559f8b2a3bf7106406f6d2 (diff) | |
[ruby/reline] Cache pasting state in processing a key
Because it's too slow.
The rendering time in IRB has been reduced as follows:
start = Time.now
def each_top_level_statement
initialize_input
catch(:TERM_INPUT) do
loop do
begin
prompt
unless l = lex
throw :TERM_INPUT if @line == ''
else
@line_no += l.count("\n")
next if l == "\n"
@line.concat l
if @code_block_open or @ltype or @continue or @indent > 0
next
end
end
if @line != "\n"
@line.force_encoding(@io.encoding)
yield @line, @exp_line_no
end
break if @io.eof?
@line = ''
@exp_line_no = @line_no
@indent = 0
rescue TerminateLineInput
initialize_input
prompt
end
end
end
end
puts "Duration: #{Time.now - start} seconds"
0.22sec -> 0.14sec
https://github.com/ruby/reline/commit/b8b3dd52c0
Diffstat (limited to 'spec/ruby/core')
0 files changed, 0 insertions, 0 deletions
