1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/lib
aycabta 3d0bcf1cc2 [ruby/reline] Optimize ASCII character width calculation
The rendering time in IRB has been reduced as follows:

  start = Time.now

  [{"_id"=>"5f9072a4589a06d2d74b6028",
    "index"=>0,
    "guid"=>"6b3051e2-dbc7-4537-bdb9-6cd7bb5358a7",
    "isActive"=>true,
    "balance"=>"$1,442.84",
    "picture"=>"http://placehold.it/32x32",
    "age"=>34,
    "eyeColor"=>"blue",
    "name"=>{"first"=>"Ward", "last"=>"Levy"},
    "company"=>"HYPLEX",
    "email"=>"ward.levy@hyplex.us",
    "phone"=>"+1 (867) 568-3319",
    "address"=>"867 Cobek Court, Clara, Maryland, 3254",
    "about"=>
     "Exercitation eu ex aliqua sit. Pariatur aliquip incididunt sint id non consectetur ullamco Lorem ea mollit duis amet sint labore. Commodo laborum labore commodo officia in cillum adipisicing esse excepteur cupidatat adipisicing ut. Non esse incididunt voluptate aliquip cillum eu aute duis laboris sit et. Amet enim quis tempor occaecat excepteur exercitation excepteur deserunt amet cillum adipisicing.",
    "registered"=>"Monday, May 25, 2015 6:51 AM",
    "latitude"=>"16.001127",
    "longitude"=>"-72.377848",
    "tags"=>["dolore", "nostrud", "occaecat", "cillum", "nisi"],
    "range"=>[0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
    "friends"=>
     [{"id"=>0, "name"=>"Alison Bryant"},
      {"id"=>1, "name"=>"Ester Espinoza"},
      {"id"=>2, "name"=>"Sullivan Kane"}],
    "greeting"=>"Hello, Ward! You have 7 unread messages.",
    "favoriteFruit"=>"apple"}]

  puts "Duration: #{Time.now - start} seconds"

0.73sec -> 0.43sec

  start = Time.now

  "Exercitation eu ex aliqua sit. Pariatur aliquip incididunt sint id non consectetur ullamco Lorem ea mollit duis amet sint labore. Commodo laborum labore commodo officia in cillum adipisicing esse excepteur cupidatat adipisicing ut. Non esse incididunt voluptate aliquip cillum eu aute duis laboris sit et. Amet enim quis tempor occaecat excepteur exercitation excepteur deserunt amet cillum adipisicing."

  puts "Duration: #{Time.now - start} seconds"

0.15sec -> 0.10sec

  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.59sec -> 0.38sec

Co-authored-by: NARUSE, Yui <naruse@airemix.jp>

https://github.com/ruby/reline/commit/36bc9e3abb
2020-12-05 02:58:59 +09:00
..
benchmark Update the license for the default gems to dual licenses 2020-08-18 20:26:39 +09:00
bundler Merge bundler-2.2.0.rc.2 2020-10-15 17:19:02 +09:00
cgi Update the license for the default gems to dual licenses 2020-08-18 20:26:39 +09:00
csv [ruby/csv] Add support for \r\n with skip_lines: /...$/ again 2020-11-24 09:33:55 +09:00
delegate Update the license for the default gems to dual licenses 2020-08-18 20:26:39 +09:00
did_you_mean Remove experimental feaures and related code completely 2020-06-06 14:13:19 -04:00
drb Separate send into public_send and __send__ 2020-10-27 16:12:45 +09:00
forwardable [ruby/forwardable] Specify minimum Ruby version. 2020-12-03 17:35:29 +09:00
getoptlong Update the license for the default gems to dual licenses 2020-08-18 20:26:39 +09:00
irb [ruby/irb] Add a fallback for check_code_block that does not depend on implementation-private APIs 2020-11-22 21:00:11 +09:00
logger [ruby/logger] Consider cygwin a Windows platform 2020-12-04 20:16:00 +09:00
matrix Update the license for the default gems to dual licenses 2020-08-18 20:26:39 +09:00
net digest gem is available now 2020-12-03 19:17:29 +09:00
observer Update the license for the default gems to dual licenses 2020-08-18 20:26:39 +09:00
optparse Added the missing licenses field to some default gems 2020-08-18 20:26:39 +09:00
ostruct Update the license for the default gems to dual licenses 2020-08-18 20:26:39 +09:00
pstore Update the license for the default gems to dual licenses 2020-08-18 20:26:39 +09:00
racc [ruby/racc] Bump version to 1.5.1 2020-11-10 21:35:04 +09:00
rdoc Backport cosmetic changes from upstream repo that is ruby/rdoc 2020-11-12 21:05:59 +09:00
reline [ruby/reline] Optimize ASCII character width calculation 2020-12-05 02:58:59 +09:00
rinda Added dependencies for rinda 2020-12-04 20:21:41 +09:00
rubygems Merge rubygems-3.2.0.rc.2 2020-10-15 14:12:02 +09:00
singleton Update the license for the default gems to dual licenses 2020-08-18 20:26:39 +09:00
timeout Update the license for the default gems to dual licenses 2020-08-18 20:26:39 +09:00
tracer Update the license for the default gems to dual licenses 2020-08-18 20:26:39 +09:00
unicode_normalize
uri Separate send into public_send and __send__ 2020-10-27 16:12:45 +09:00
weakref Added dependencies for weakref 2020-12-01 19:48:24 +09:00
webrick Revert https://github.com/ruby/webrick/pull/44 2020-11-13 12:06:42 +09:00
yaml Update the license for the default gems to dual licenses 2020-08-18 20:26:39 +09:00
.document Bundler is not documented in RDoc, but something different 2020-04-07 13:01:19 +09:00
abbrev.gemspec Promote abbrev to default gems 2020-09-10 18:56:16 +09:00
abbrev.rb
base64.gemspec Promote base64 to default gems 2020-09-10 18:56:17 +09:00
base64.rb
benchmark.rb
bundler.rb Merge bundler-2.2.0.rc.2 2020-10-15 17:19:02 +09:00
cgi.rb Extract version number from the source 2020-07-30 19:03:18 +09:00
csv.rb [ruby/csv] Clarify and correct RDoc for converters (#178) 2020-11-24 09:33:55 +09:00
debug.gemspec Promote debug.rb to default gems. 2020-10-30 21:45:23 +09:00
debug.rb [Feature #16513] TracePoint#inspect returns "... file:line" (#3391) 2020-08-06 11:56:24 +09:00
delegate.rb Extract version number from the source 2020-07-30 19:03:18 +09:00
did_you_mean.rb Sync did_you_mean 2020-06-06 13:02:08 -04:00
drb.rb
English.gemspec Added the missing licenses field to some default gems 2020-08-18 20:26:39 +09:00
English.rb
erb.gemspec Added dependencies for erb 2020-12-02 09:12:25 +09:00
erb.rb
fileutils.gemspec Update the license for the default gems to dual licenses 2020-08-18 20:26:39 +09:00
fileutils.rb [ruby/fileutils] Make mkdir_p only attempt to create necessary directories 2020-12-04 19:50:26 +09:00
find.gemspec Promote find to default gems 2020-08-20 21:00:53 +09:00
find.rb
forwardable.rb Revert "Prefer #send over #__send__ when it is clear there is no possible conflict" 2020-11-05 20:54:34 +09:00
getoptlong.rb Extract version number from the source 2020-07-30 19:03:18 +09:00
ipaddr.gemspec [ruby/ipaddr] fixup 90b46678a5b09ed32612b0629b7c51c6d39a0444 2020-12-03 17:48:32 +09:00
ipaddr.rb
irb.rb [ruby/irb] Stop using bang version for #inspect of result 2020-11-22 21:00:11 +09:00
logger.rb [ruby/logger] Mention File::Null in Logger#new document 2020-06-11 14:22:32 +09:00
matrix.rb [ruby/matrix] Add Matrix#adjoint [#14] 2020-05-01 03:25:15 -04:00
mkmf.rb Separate send into public_send and __send__ 2020-10-27 16:12:45 +09:00
mutex_m.gemspec Update the license for the default gems to dual licenses 2020-08-18 20:26:39 +09:00
mutex_m.rb [ruby/mutex_m] Fix Mutex_m#initialize when the super's initialize has kwargs 2020-12-04 19:53:16 +09:00
observer.rb Separate send into public_send and __send__ 2020-10-27 16:12:45 +09:00
open-uri.gemspec Added dependencies for open-uri 2020-12-01 19:48:24 +09:00
open-uri.rb Remove the deprecated override of Kernel#open in open-uri 2020-08-16 07:41:40 -07:00
open3.gemspec Manually picked 724bdb8e1d 2020-09-14 14:07:37 +09:00
open3.rb Extract version number from the source 2020-07-30 19:03:18 +09:00
optionparser.rb
optparse.rb Separate send into public_send and __send__ 2020-10-27 16:12:45 +09:00
ostruct.rb [ruby/ostruct] Update version 2020-11-04 17:52:03 -05:00
pp.gemspec Added dependencies for pp 2020-12-02 09:12:25 +09:00
pp.rb Fix pp when passed a empty ruby2_keywords-flagged hash as array element 2020-01-22 10:27:02 -08:00
prettyprint.gemspec Promote prettyprint to default gems 2020-10-08 16:40:46 +09:00
prettyprint.rb Fix articles. 2020-04-11 02:32:23 +09:00
prime.gemspec Added dependencies for prime 2020-12-01 19:48:24 +09:00
prime.rb Improve docs for Prime.{prime_division,int_from_prime_division} (#8) 2020-03-06 20:55:22 +09:00
pstore.rb Extract version number from the source 2020-07-30 19:03:18 +09:00
racc.rb
rdoc.rb Skip the initialization of XDG_DATA_HOME with Permission denied 2020-04-23 21:11:21 +09:00
readline.gemspec Fixed the invalid SPDX identifier on gemspec 2020-08-18 20:26:40 +09:00
readline.rb
reline.rb [ruby/reline] Suppress callbacks in pasting 2020-12-05 02:58:58 +09:00
resolv-replace.gemspec Promote resolv-replace to default gems 2020-09-11 22:01:08 +09:00
resolv-replace.rb
resolv.gemspec Promote resolv to default gems 2020-09-11 21:50:07 +09:00
resolv.rb fe80 should be case insensitive too 2020-11-09 16:16:30 +09:00
rubygems.rb Merge rubygems-3.2.0.rc.2 2020-10-15 14:12:02 +09:00
securerandom.gemspec Promote securerandom to default gems 2020-09-11 21:15:25 +09:00
securerandom.rb Make SecureRandom support Ractor 2020-09-09 12:45:43 -07:00
set.gemspec Promote set to default gems 2020-08-20 12:39:11 +09:00
set.rb [ruby/set] Add Set#<=> 2020-12-04 19:24:22 +09:00
shellwords.gemspec Promote shellwords to default gems 2020-09-10 18:56:17 +09:00
shellwords.rb Fix the ArgumentError message in shellsplit 2020-06-16 23:23:13 +09:00
singleton.rb Extract version number from the source 2020-07-30 19:03:18 +09:00
tempfile.gemspec Added the missing licenses field to some default gems 2020-08-18 20:26:39 +09:00
tempfile.rb [ruby/tempfile] Improve the documentation for Tempfile.create and recommend Tempfile.open instead 2020-10-05 19:17:25 +02:00
time.gemspec Added dependencies for time 2020-12-01 19:48:24 +09:00
time.rb [DOC] Mentioned that Time.parse method is not validator 2020-06-21 16:16:15 +09:00
timeout.rb Extract version number from the source 2020-07-30 19:03:18 +09:00
tmpdir.gemspec Added dependencies for tmpdir 2020-12-02 09:12:25 +09:00
tmpdir.rb [ruby/tmpdir] Warn when environment variables skipped (fixes #2) 2020-09-14 18:22:37 +09:00
tracer.rb Extract version number from the source 2020-07-30 19:03:18 +09:00
tsort.gemspec Promote tsort to default gems 2020-09-09 21:53:09 +09:00
tsort.rb
un.gemspec Promote un.rb to the default gems. It's preparation for 3.0.0-preview2. 2020-11-05 20:21:31 +09:00
un.rb Revert "Prefer #send over #__send__ when it is clear there is no possible conflict" 2020-11-05 20:54:34 +09:00
uri.rb [ruby/uri] Remove RCS keywords 2020-03-26 18:06:14 +09:00
weakref.rb Extract version number from the source 2020-07-30 19:03:18 +09:00
webrick.rb [webrick][DOC] Describe the stance of WEBrick about its security and utilization (#3457) 2020-08-26 14:28:05 +09:00
yaml.rb Remove unnecessary word from comment 2020-07-28 12:14:45 +09:00