Skip to content

Commit

Permalink
Add a benchmark using IRB::Color
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
k0kubun committed Jun 1, 2019
1 parent 56660de commit f630359
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions 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

0 comments on commit f630359

Please sign in to comment.