2014-06-12 22:25:39 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								require_relative '../../benchmark_helper'
							 | 
						
					
						
							
								
									
										
										
										
											2014-03-21 15:59:44 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								string = 'Hello, how are you doing today?'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								small  = "<![CDATA[#{string}]]>"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								medium = "<![CDATA[#{string * 1_000}]]>"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								large  = "<![CDATA[#{string * 10_000}]]>"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								Benchmark.ips do |bench|
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  bench.report 'CDATA with a small body' do
							 | 
						
					
						
							
								
									
										
										
										
											2014-04-10 07:55:33 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    Oga::XML::Lexer.new(small).lex
							 | 
						
					
						
							
								
									
										
										
										
											2014-03-21 15:59:44 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  end
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  bench.report 'CDATA with a medium body' do
							 | 
						
					
						
							
								
									
										
										
										
											2014-04-10 07:55:33 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    Oga::XML::Lexer.new(medium).lex
							 | 
						
					
						
							
								
									
										
										
										
											2014-03-21 15:59:44 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  end
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  bench.report 'CDATA with a large body' do
							 | 
						
					
						
							
								
									
										
										
										
											2014-04-10 07:55:33 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    Oga::XML::Lexer.new(large).lex
							 | 
						
					
						
							
								
									
										
										
										
											2014-03-21 15:59:44 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  end
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								end
							 |