Weak reference performance regression on 10.9

Originator:matt
Number:rdar://15301054 Date Originated:23-Oct-2013 01:09 PM
Status:Closed Resolved:09-Dec-2014 04:07 PM
Product:OS X SDK Product Version:10.9/13A603
Classification:Performance Reproducible:Always
 
Summary:

Performance of assigning a large number of weak references grows progressively worse on 10.9.

Steps to Reproduce:

Run the attached sample project.

Expected Results:

Execution time for each iteration is approximately the same.

Actual Results:

Execution time grows progressively worse.

Version:

OS X 10.9/13A603
Xcode 5.0.1/5A2053

Notes:

The problem case is only observed under specific conditions, launching the attached project through Xcode or Launch Services will result in the problem case, launching it through Instruments or directly from Terminal will not. Attached is an Instruments trace for the slow case showing the time is mostly spent in append_referrer().

Thanks to Mike Ash for investigating the issue and noticing that in the slow case the addresses of the weak references are incremented consistently while in the fast case they are much more scattered (see attached logs). He also noticed that append_referrer() previously had code to produce better hash values for the problem case, but this appears to have been removed in 10.9.

Configuration:

Always observable on 10.9.
Does not occur on 10.8.

Attachments:

'WeakRefTest.zip', 'WeakRefTest.trace.zip' and 'Logs.zip' were successfully uploaded.

Comments

Matthew Stevens

No longer reproducible on 10.10. This issue has been verified as resolved and can be closed.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!