2 ms·
I am not sure I would call this a bug. Is "call calloc, free, and calloc, without ever touching the memory" really a use case one should optimize for? One could
by Someone 10y ago
I am not sure I would call this a bug. Is "call calloc, free, and calloc, without ever touching the memory" really a use case one should optimize for? One could argue that improving performance for this case only is worthwhile if it can be done in a way that barely impacts anything else.
Edit: apologies for being somewhat ambiguous. The "bug" I refer to is the Radar issue the writer of the blog created, not the performance issue with the Python code.
- loeg 10y agoIt barely impacts anything else.
- CalChris 10y agoThe author had a bug report in front of him. The behavior was repeatable and certainly unexpected. That is worth tracking down. I've tracked down corner cases like this myself and been correctly told by developers that they're not worth fixing. But you don't know that a priori.
- eridius 10y agoThe bug report wasn't caused by calloc, free, calloc being expensive. It was caused by making a call that did "malloc + memset" when only malloc was needed. The code in question wasn't even invoking calloc at all, it just ended up being an excuse to investigate zeroing memory behavior. Incidentally, the blog post asks "why was the memory being actively zeroed at all?" but never actually answers it.
- citrin_ru 10y agoDoes PyOpenSSL allocate memory and the free without touch? If not, this test case may be not relevant to the bug.