mirror of
				https://github.com/python/cpython.git
				synced 2025-11-04 03:44:55 +00:00 
			
		
		
		
	Special case endpoint access for speed.
This commit is contained in:
		
							parent
							
								
									30e97dbe96
								
							
						
					
					
						commit
						6c79a518e7
					
				
					 1 changed files with 18 additions and 10 deletions
				
			
		| 
						 | 
				
			
			@ -326,6 +326,13 @@ deque_item(dequeobject *deque, int i)
 | 
			
		|||
		return NULL;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (i == 0) {
 | 
			
		||||
		i = deque->leftindex;
 | 
			
		||||
		b = deque->leftblock;
 | 
			
		||||
	} else if (i == deque->len - 1) {
 | 
			
		||||
		i = deque->rightindex;
 | 
			
		||||
		b = deque->rightblock;
 | 
			
		||||
	} else {
 | 
			
		||||
		i += deque->leftindex;
 | 
			
		||||
		n = i / BLOCKLEN;
 | 
			
		||||
		i %= BLOCKLEN;
 | 
			
		||||
| 
						 | 
				
			
			@ -339,6 +346,7 @@ deque_item(dequeobject *deque, int i)
 | 
			
		|||
			while (n--)
 | 
			
		||||
				b = b->leftlink;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	item = b->data[i];
 | 
			
		||||
	Py_INCREF(item);
 | 
			
		||||
	return item;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue