As far as CPU and memory usage, how efficient are C-style coding blocks in Objective-C? I’m creating a bruteforcing library for Objective-C and I need to optimize it as much as possible. The code block being used is called on every iteration of the bruteforcer.
Share
Like with functional languages, the creation of the block (closure) may require an allocation on the heap (this certainly happen when you copy the block, maybe the compiler can avoid it when you just use the block in an inner frame).
Any case, if this happen outside of your loop, you pay the price once. Calling a block should cost about the same as calling a virtual method on a C++ instance object (since this is approximately the same task