iphone - Objective-C: Calling and copying the same block from multiple threads -


I am working here from the neural network, but it is safe to ignore it, because the real question is to deal with the block Objective c. My point here is that I found a way to convert a neural network into a large block, which can be executed at once, though, in fact it is actually slow, relative to activating the network. It seems a little prudent.

If I have given you a group of nested functions like

  CGflot answer = sin (cos (Gaussian (1.5 × x + 2.5 * y)) + (.3 * D + bias) / or in block notation ^ (CGFlot X, CGflot Y, CGFlot D, CGflot bias) {Return Sin (Cos (Gaussi (1.5 × x + 2.5 * y)) + (.3 * D + bias )); }; In theory, running a function should be easier / faster than looping through a bunch of contacts, and setting active / passive nodes, all of which essentially calculate this same function. End.  

However, when I create a block (see thread) and run this code, then it is slow for a soft size network.

Now, which I do not quite understand:

  1. When you copy a block, what are you actually copying?
  2. Suppose I copy a block twice, copy1 and copy2. If I call copy1 and copy2 on the same thread, is such a function called? I did not understand what docs meant for block copies:
  3. Now if I copy it, copy1 and copy2, but instead, I copied the different thread Call, how do behaviors work now? Will it be the cause of some kind of recession, because each thread tries to reach the same block?

    When you copy a block, what exactly do you copy Copying?

    You are copying any state, which has occupied the block. If the block does not take any state - which does not appear to that block - then the copy should be "free" so that the block will be continuous (as "how" works).

    Suppose I copy a block twice, copy1 and copy2. If I call copy1 and copy2 on the same thread, then such a function is called? I absolutely do not understand what docks mean for block copies: Apple block docs

    When a block is copied, the code of the block is not copied only captured So the state, yes, you will execute the exact set of instructions.

    Now if I rebuild that copy, copy1 and copy2, but instead, I call copies on different threads, now how do behaviors work? Will this be the reason for any recession, because every thread tries to use the same block?

    The data captured in any block is not safe from any kind of multi-threaded access, therefore, there will be no recession (but all the syncometry synchronization can be fun, which you can imagine Can).

    Have you tried to sample an app to see what the CPU cycle is consuming? Apart from this, where you are going with this, you want to get acquainted with your friendly local dishamember ( otool -TtVv binary / or / .o / file>) because it is very helpful in determining Maybe that's how expensive per block really is.


    If you are looking at a lot of time in the block and looking at it, it would use your computations to CPU CPU time during the copy, so if you had to consume the block CPU Will watch consumption

    Try creating a source file that contains different types of blocks; With the unmanned occupation of the state, with the criteria of / without occupied state etc., without the occupied state. And a function that calls block_copy () on each

    Disassemble it and what happens to you when the blocks are copied, to understand it privately, I get a x86_64 assembly to be easy to read in comparison to AMAM. (This sounds like a good blog fodder - I should write it).

Comments