mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 22:02:44 +00:00 
			
		
		
		
	 8f722302d9
			
		
	
	
		8f722302d9
		
	
	
	
	
		
			
			Generate a sorted, compressed series of ranges in a match table for character classes, and use a binary search to find the matches. This is about a 3-4x speedup for character class match performance. :^)
		
			
				
	
	
		
			20 lines
		
	
	
	
		
			414 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
	
		
			414 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2021, Ali Mohammad Pur <mpfard@serenityos.org>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include "Forward.h"
 | |
| #include <AK/Vector.h>
 | |
| 
 | |
| namespace regex {
 | |
| 
 | |
| class Optimizer {
 | |
| public:
 | |
|     static void append_alternation(ByteCode& target, ByteCode&& left, ByteCode&& right);
 | |
|     static void append_character_class(ByteCode& target, Vector<CompareTypeAndValuePair>&& pairs);
 | |
| };
 | |
| 
 | |
| }
 |