performance - How to preallocate a buffer of certain size in Python? -


i have use case want combine multiple chunk of buffers single buffer. in case of c/c++/java preallocate buffer size same combined size of source buffers, copy source buffers it. how can done in python in similar way. want avoid creating multiple smaller intermediate buffers may have bad impact on performance.

i think best way wanna is:

initial_value = none # or 0, false, etc. size = 10 # or size of buffer buffer = size * [initial_value] 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -