Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Optimizing a CFStringRef for CFStringCompare usage



If it's only a few hundred then I wouldn't worry about it that much.

Partly it depends on whether you are doing a localized (human-order) compare or not. Are you specifying the localized compare option?

If it's a very large database, the fastest option is to keep the data as raw UTF-16, and get collation keys using UCGetCollationKey and UCCompareCollationKeys. See:

<http://developer.apple.com/documentation/Carbon/Reference/ Unicode_Utilities_Ref/uu_refchap/chapter_1.2_section_3.html#// apple_ref/doc/uid/TP30000122-//apple_ref/doc/uid/TP30000122-109241- TPXREF104>

However, it would have to be a pretty large sort to make it worth extracting the UTF-16 if the data is not already in that form.

Deborah Goldsmith
Internationalization, Unicode liaison
Apple Computer, Inc.
email@hidden

On Jul 29, 2005, at 9:17 AM, Matt Gough wrote:

Suppose I have a bunch (many hundreds) of CFStringRefs that could have come from anywhere and which are cached and I need to sort them (possibly multiple times) as quickly as possible using CFStringCompare. Is there anything I could do to my cached versions so that the guts of CFStringCompare runs as fast as possible.

I am thinking maybe ensuring that my cached versions have real unicode storage and are not left as 8-bit ascii for some strings etc.

Is this worthwhile and if so what is the correct way of getting my strings in such a state.

Matt Gough
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. Carbon-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden
References: 
 >Optimizing a CFStringRef for CFStringCompare usage (From: Matt Gough <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.