Re: Performance problem with GC enabled
Re: Performance problem with GC enabled
- Subject: Re: Performance problem with GC enabled
- From: Peter Ammon <email@hidden>
- Date: Thu, 12 Mar 2009 12:17:18 -0700
On Mar 12, 2009, at 6:04 AM, John Engelhart wrote:
This is (obviously) due to -fobjc-gc turning the storing of a __strong
pointer in to a call to objc_assign_strongCast(). Each and every call
to objc_assign_strongCast, in turn, grabs a gc lock before it does its
work. Soo.. what was a simple, single movl instruction of the
returned pointer in to the matchedStrings array has now turned in to,
at a minimum, a function call and an expensive mutex lock acquisition,
a lock that is pretty heavily contested to boot, and that doesn't even
include any of the work done inside the function itself.
....
This kind of reduction in performance is just flat out unacceptable,
and I can't think of anything I can do to speed things up. Any ideas?
Hi John,
Instead of storing each string individually into the heap, try
batching up, say, 1k or so into a stack allocated buffer. Then use
objc_memmove_collectable() to move them in bulk into the heap at the
point your stack allocated buffer gets full, or your scan finishes.
-Peter
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden