Jump to content

Autorelease is fast...


2 posts in this topic

Recommended Posts

For those cocoa programmers out there:

 

http://www.mikeash.com/blog/pivot/entry.php?id=19#body

 

"If you've done much Cocoa programming, you've probably run into a situation where you needed to create a local autorelease pool because of some sort of loop. And you've probably run into advice telling you not to create and destroy the pool for every iteration, because that would be slow. I never believed that it could be significant, and I finally took the time to test it today. What's the verdict? Just as I thought, making autorelease pools is really fast."

Link to comment
Share on other sites

I have been more liberal in my use of NSAutoreleasePools lately, so this is good news. It is really interesting to see results which suggest that the use of more NSAutoreleasePool can be faster in some cases do to the fact that "memory managment" takes time.

 

One of the commentors states that the amount of computational overhead scales with the square of the number of objects allocated. While I think it would be better to say that it scales with some function of the amount memory allocated instead, it is still something that is perhaps commonly overlooked in performance considerations.

Link to comment
Share on other sites

 Share

×
×
  • Create New...