mirror of
				https://github.com/python/cpython.git
				synced 2025-10-30 21:21:22 +00:00 
			
		
		
		
	needforspeed: speed up unicode repeat, unicode string copy
This commit is contained in:
		
							parent
							
								
									d82c3105cc
								
							
						
					
					
						commit
						f1d60a5384
					
				
					 2 changed files with 14 additions and 8 deletions
				
			
		|  | @ -5898,10 +5898,13 @@ unicode_repeat(PyUnicodeObject *str, Py_ssize_t len) | |||
| 
 | ||||
|     p = u->str; | ||||
| 
 | ||||
|     while (len-- > 0) { | ||||
|         Py_UNICODE_COPY(p, str->str, str->length); | ||||
|         p += str->length; | ||||
|     } | ||||
|     if (str->length == 1 && len > 0) { | ||||
|         Py_UNICODE_FILL(p, str->str[0], len); | ||||
|     } else | ||||
|         while (len-- > 0) { | ||||
|             Py_UNICODE_COPY(p, str->str, str->length); | ||||
|             p += str->length; | ||||
|         } | ||||
| 
 | ||||
|     return (PyObject*) u; | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Fredrik Lundh
						Fredrik Lundh