Project

General

Profile

« Previous | Next » 

Revision 35c7e83b

Added by k0kubun (Takashi Kokubun) over 4 years ago

[ruby/irb] Optimize show_source command further

https://github.com/ruby/irb/pull/249 actually slowed down how code is
concatenated. The original way of creating code is faster.

[before]
user system total real
2.420137 0.005364 2.425501 ( 2.426264)

[after]
user system total real
1.000221 0.007454 1.007675 ( 1.008295)

Theoretically, this implementation might skip lines that don't appear in
Ripper tokens, but this assumes such lines don't impact whether the code
passes compilation or not. At least normal blank lines seem to have an
on_ignored_nl token anyway though.

https://github.com/ruby/irb/commit/27dd2867cd