PlotIconRefInContext of duplicated icons 200-500x slower on Mavericks
| Originator: | james.walter.matthews | ||
| Number: | rdar://16302067 | Date Originated: | 12-Mar-2014 |
| Status: | Open | Resolved: | |
| Product: | OS X | Product Version: | 10.9.2/13C64 |
| Classification: | Performance | Reproducible: | Yes |
Summary: When OS X 10.9 Mavericks was released we noticed that scrolling of long file lists in our Fetch application was much slower than on 10.8. Instruments revealed that the time was being spent in PlotIconRefInContext, and specifically in md5_compress (which was being indirectly called by PlotIconRefInContext). This problem only appeared when the IconRef, which had been returned by GetIconRefFromFileInfo, was then duplicated using IconRefToIconFamily and RegisterIconRefFromIconFamily. I wrote a small program, PlotIconPerfTest, to illustrate the problem. It prompts for a file or folder, and then draws the item's icon as many times as it can in 200 milliseconds, and reports the number of icons plotted per second. When the "Use icon duplicate" checkbox is unchecked the application draws the IconRef returned by GetIconRefFromFileInfo; when checked it draws the duplicate icon returned by RegisterIconRefFromIconFamily. The icon loading code is in the function IconRefFromFSRef(), in AppDelegate.m. Steps to Reproduce: 1. Open the attached PlotIconPerfTest application on 10.9 or 10.8 2. Choose a file or folder 3. Toggle the "Use icon duplicate" checkbox, and/or resize the window to force redrawing Expected Results: On a modern machine the reported performance should be over 100,000 icons/s, on both 10.8 and 10.9, with either a file or folder icon, regardless of the setting of the "Use icon duplicate" setting. Actual Results: On 10.8 the results are as expected. On 10.9 the drawing rate with "Use icon duplicate" is 1/500 to 1/200 that with "Use icon duplicate" off, e.g. 200-500 icons/s. Instruments reveals that when "Use icon duplicate" is checked, most CPU time is spent computing MD5 hashes. Version: 10.9.2/13C64 Notes:
Comments
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!