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
Post a Comment