Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6359809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:34:06+00:00 2026-05-24T23:34:06+00:00

Question is the same as the title. (sortedArrayHint method of NSArray class, what is

  • 0

Question is the same as the title.
(“sortedArrayHint” method of NSArray class, what is the purpose of this method and how is it used)

I read documentation but the explanation is not clear.

Please explain the purpose of this method and its usage.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T23:34:06+00:00Added an answer on May 24, 2026 at 11:34 pm

    The idea is simple. Assume you have a large array that should always be sorted. Changing or inserting even one element means you have to resort the array. Sorting is costly.

    The method -[NSArray sortedArrayHint] can be called on an already sorted array in order to get private internal data that can be used to speed up a sort of the same array given that only a small change has been made.

    Usage is simple:

    1. Get and store the hint from the original sorted array using -[NSArray sortedArrayHint].
    2. After a small change; resort using -[NSArray sortedArrayUsingFunction:context:hint:] with the stored hint.
    3. After a large change; resort using -[NSArray sortedArrayUsingFunction:context:], and get a new hint.

    What is a small, or large, change is something you must measure with Instruments.

    I never use this myself, since I have found it more effective to use my own categories on NSArray and NSMutabelArray for sorted inserts, that uses a binary search, on sorted array. My code is available as open source here: https://github.com/Jayway/CWFoundation

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have question with this same title here but now as I'll present in
There is a question here in stackoverflow with the same title but that is
This is the same question as this but I'm looking for a classic ASP
I have the same question as #1895500 , but with PostgreSQL not MySQL. How
My question is same as the title. I have not done Test driven development
I could not think of a better way to title this question. my apologies
I asked the almost the same question before also, but i have not yet
Update: The question title can be misleading. This was not Go's fault at all.
Again same question title but requirement is somewhat different. We have implemented push notification
I have the same problem like this question: Custom title bar in PreferenceActivity? After

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.