[前][次][番号順一覧][スレッド一覧]

ruby-changes:55948

From: Takashi <ko1@a...>
Date: Sat, 1 Jun 2019 20:08:07 +0900 (JST)
Subject: [ruby-changes:55948] Takashi Kokubun: f630359d9b (trunk): Add a benchmark using IRB::Color

https://git.ruby-lang.org/ruby.git/commit/?id=f630359d9b

From f630359d9b60e298e472a62f0b6ff17f17ef5c69 Mon Sep 17 00:00:00 2001
From: Takashi Kokubun <takashikkbn@g...>
Date: Sat, 1 Jun 2019 19:38:13 +0900
Subject: Add a benchmark using IRB::Color

I heard actually this part would not be a bottleneck for rendering
because writing anything to terminal takes way longer time anyway, but I
thought this benchmark script might be useful for benchmarking Ruby
itself.

diff --git a/benchmark/irb_color.yml b/benchmark/irb_color.yml
new file mode 100644
index 0000000..ebdc8d7
--- /dev/null
+++ b/benchmark/irb_color.yml
@@ -0,0 +1,13 @@ https://github.com/ruby/ruby/blob/trunk/benchmark/irb_color.yml#L1
+prelude: |
+  require 'irb/color'
+  code = <<~'CODE'
+    def self.foo # bar
+      :"erb #{ERB.new("<%= self %>", trim_mode: ?-).result}"
+    end
+  CODE
+benchmark:
+  irb_color_complete: |
+    IRB::Color.colorize_code(code, complete: true)
+  irb_color_incomplete: |
+    IRB::Color.colorize_code(code, complete: false)
+loop_count: 2000000
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]