lib/impls/reader_iobuf.rb
def read_one_char
      cache if @buf.eos?
      return nil if @buf.eos?
      
      @buf.getch
    end
# Since you parse char by char, you will be tempted to do it in a tight loop
# and to call eof? on each iteration. Don't. Instead. allow it to raise and do not check.
# This takes the profile time down from 36 seconds to 30 seconds for a large file.
Since you parse char by char, you will be tempted to do it in a tight loop
and to call eof. on each iteration. Don't. Instead. allow it to raise and do not check.
This takes the profile time down from 36 seconds to 30 seconds for a large file.
Since you parse char by char you will be tempted to do it in a tight loop and to call eof . on each iteration . Don ' t . Instead . allow it to raise and do not check . This takes the profile time down from 36 seconds to 30 seconds for a large file .
def read_one_char
      cache if @buf.eos?
      return nil if @buf.eos?
      @buf.getch
    end
def read_one_char cache if @buf . eos? return nil if @buf . eos? @buf . getch end
Since you parse char by char, you will be tempted to do it in a tight loop
and to call eof?
Since you parse char by char you will be tempted to do it in a tight loop and to call eof?