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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T16:25:46+00:00 2026-06-14T16:25:46+00:00

In my app I have to store path points into an array and then

  • 0

In my app I have to store path points into an array and then follow those points. To get a smoother run I usually have to dump a path into 5k points. This means I have to store 10k floats- 5k for x and 5k for y coordinates. Right now this is what I’m doing:

1.In the view load I initialize an NSArray with those 10k numbers like this:

pathPoints=[NSArray arrayWithObjects:[NSNumber numberWithFloat:-134.8427],  [NSNumber numberWithFloat:148.8433], ....... and so on];
  1. And then I read it like this:

    int currentXIndex=..////

    [[pathPoints objectAtIndex:currentXIndex] floatValue];

    [[pathPoints objectAtIndex:currentXIndex+1] floatValue];

As you can see, each time when I need the next position? I have to unbox it(cast it from NSNumber to float). And I’m sure this takes a great deal of performance. Any suggestions how I can do this another, more performant way?

  • 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-14T16:25:48+00:00Added an answer on June 14, 2026 at 4:25 pm

    For a simple container, I’d use a C array and traverse with pointers. Remember that Objective C is a superset of C, so you have everything right there for when the need arise.

    edit; sample code:

    you don’t have to store all numbers ‘naked’, a struct don’t have any overhead:

    typedef struct tCoords {
        float x, y;
    } tCoords;
    

    then just malloc() the size needed:

    arraySize = 5000;
    tCoords *array = malloc(arraySize * sizeof(tCoords));
    

    and iterate like any simple array:

    tCoords *end = array+arraySize;
    
    for (tCoords *p = array; p<end; ++p) {
        float x = p->x;
        float y = p->y;
    }
    

    If you don’t like the “old C” look of the code, it’s easy to encapsulate all this in a class that ‘owns’ the array (don’t forget to free() it when disposed)

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

Sidebar

Related Questions

In my app i have about 30 strings i would like to store somewhere.
I'm programming an Android app, where I have to store pictures to some online
I have an app on the store, with populated data in a CoreData base.
I have an app on the Store for which we’re readying an update. The
I have an app on the app store, that uses coredata as storage. I
I currently have an app published on the App Store but I've just updated
So I have this App in the store, and I would like to release
I have an App in which I record the sound files and store it
I am working on a store locator web app and I have a problem
Previously, I have an app that uses core data. I use same store url

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.