3 ms·
Somebody needs to go update all the StackOverflow answers saying that malloc is faster. According to this, calloc seem to always be faster with several other b
by ericfrederich 10y ago
Somebody needs to go update all the StackOverflow answers saying that malloc is faster. According to this, calloc seem to always be faster with several other benefits as well.
- bcpermafrost 10y agoIt is not as you say. The article suggests that Malloc + Memset is slower than Calloc. Malloc will be faster depending on your use case. If your plan is to eventually call memset. Then just use Calloc, otherwise malloc will be faster all the time.
- Twirrim 10y agon00b question: Why would you not memset? I would assume you'd want to start with all zeroed memory in almost all cases.