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 7834873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T13:22:11+00:00 2026-06-02T13:22:11+00:00

I have the following code that is taking a while to process: self.itemsArray =

  • 0

I have the following code that is taking a while to process:

self.itemsArray = [Helper changeTheA:self.itemsArray];
self.itemsArray = [Helper convertDates:self.itemsArray];

Is there a way, in Instruments or somewhere else, that I can measure the time is takes to go from the first line of code to the second line of code…. in ticks or milliseconds or something?

I want to do some tweaking but I need to be able to measure in order to see if I’m making an improvement over the previous code.

  • 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-06-02T13:22:19+00:00Added an answer on June 2, 2026 at 1:22 pm

    Quickest, dirtiest, possibly not very precise way

    NSDate *startDate = [NSDate date];
    
    self.itemsArray = [Helper changeTheA:self.itemsArray];
    
    NSLog(@"changeTheA time taken: %f", -[startDate timeIntervalSinceNow]);
    

    A slightly more involved but probably more useful solution, if you are doing some basic profiling can be seen here, it uses a C function that executes a block you provide.


    Big side note

    As Justin points out the actual act of creating an NSDate and then logging it out will introduce interference to your measurements and so this technique is only really any good for getting ball park figures and even then you should probably run large amounts of iterations of your code within the timing block. If you require accurate measurements then skip to Justin’s answer

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

Sidebar

Related Questions

I have following code that does not work due to a being a value
I have following code that does not work: I never get to goToFoodDetail .
I have following code snippet that i use to compile class at the run
I have the following code that creates a serverside object of the xmlhttp class.
I have the following code that loads a user's Active Directory DirectoryEntry object from
I have the following code that controls the presentation of an interdependent group. The
I have the following code that I am trying to extract the systems proxy
I have the following code that i am trying to change from a regular
I have the following code that compiles and works well: template<typename T> T GetGlobal(const
I have the following code that fills dataTable1 and dataTable2 with two simple SQL

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.