From f630359d9b60e298e472a62f0b6ff17f17ef5c69 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun 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. --- benchmark/irb_color.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 benchmark/irb_color.yml (limited to 'benchmark/irb_color.yml') diff --git a/benchmark/irb_color.yml b/benchmark/irb_color.yml new file mode 100644 index 0000000000..ebdc8d7e8b --- /dev/null +++ b/benchmark/irb_color.yml @@ -0,0 +1,13 @@ +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 v1.2.3