[swift-users] UnsafeMutablePointer on the stack?

Jens Alfke jens at mooseyard.com
Mon Oct 3 12:20:19 CDT 2016

> On Oct 2, 2016, at 5:14 PM, Mike Ferenduros via swift-users <swift-users at swift.org> wrote:
> Personally I would be surprised if the malloc caused an actual measurable performance hit tbh.

It won’t be noticeable against a call to SecRandom, as noted, but there are other circumstances where it’s a big performance hit to put a temporary buffer on the heap. (Right now I’m working on some rather performance-sensitive database code in C++ where avoiding a few heap allocations per iteration has proven to be a big win.)

Does Swift have any solution for allocating stack-based array buffers?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20161003/948526b1/attachment.html>

More information about the swift-users mailing list