mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	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.
This commit is contained in:
		
							parent
							
								
									56660de3c6
								
							
						
					
					
						commit
						f630359d9b
					
				
					 1 changed files with 13 additions and 0 deletions
				
			
		
							
								
								
									
										13
									
								
								benchmark/irb_color.yml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								benchmark/irb_color.yml
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -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
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue