mirror of
				https://github.com/python/cpython.git
				synced 2025-11-04 03:44:55 +00:00 
			
		
		
		
	Gave __xor__/symmetric_difference a factor of 2-5 speed boost.
This commit is contained in:
		
							parent
							
								
									37faed2532
								
							
						
					
					
						commit
						334b4a5c39
					
				
					 1 changed files with 6 additions and 4 deletions
				
			
		
							
								
								
									
										10
									
								
								Lib/sets.py
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								Lib/sets.py
									
										
									
									
									
								
							| 
						 | 
					@ -197,11 +197,13 @@ class BaseSet(object):
 | 
				
			||||||
        result = self.__class__()
 | 
					        result = self.__class__()
 | 
				
			||||||
        data = result._data
 | 
					        data = result._data
 | 
				
			||||||
        value = True
 | 
					        value = True
 | 
				
			||||||
        for elt in self:
 | 
					        selfdata = self._data
 | 
				
			||||||
            if elt not in other:
 | 
					        otherdata = other._data
 | 
				
			||||||
 | 
					        for elt in selfdata:
 | 
				
			||||||
 | 
					            if elt not in otherdata:
 | 
				
			||||||
                data[elt] = value
 | 
					                data[elt] = value
 | 
				
			||||||
        for elt in other:
 | 
					        for elt in otherdata:
 | 
				
			||||||
            if elt not in self:
 | 
					            if elt not in selfdata:
 | 
				
			||||||
                data[elt] = value
 | 
					                data[elt] = value
 | 
				
			||||||
        return result
 | 
					        return result
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue