Depressed.
Open more than one thread in viewDidLoad where to process the data.
Many data, however, if not multi-threaded, the time it takes about 1 second. Tragedy after using a multi-threaded, time spent probably 10 - 15 seconds.
Multi-threaded code is as follows:
[NSThread detachNewThreadSelector: @ selector (initData) toTarget: self withObject: nil];
Find good help, why is this result? Did not dare to mind
Reply:
Single-step the next, probably found the scope of the problem.
There is a cycle-threaded task, the problem is in this cycle, multi-threaded extra time spent on this cycle.
Reply:
Problems have been solved, forgot to use NSAutoreleasePool.
Reply:
Actually a man in a monologue.
I was a cloud.
Reply:
Will lz, plus NSAutoreleasePool, how efficient?
Reply:
Then the multi-threaded, it is recommended to use NSInvocationOperation
Reply:
Ashamed, the problem I encountered was not releasing memory, so multi-thread operation due to lack of enough space to hang. A little slower than the single-threaded speed, in addition to synchronization, no feeling.
Reply:
Easy access for a moment, seemingly NSinvocationOperation is to maintain a task queue, which itself is performed automatically each queue member? I do not know what is the difference and NSThread?
No comments:
Post a Comment