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

The Archive Base Latest Questions

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

This is really a few questions in one, I’m wondering what the performance cost

  • 0

This is really a few questions in one, I’m wondering what the performance cost is for these things, as I haven’t really been following a best practice of any sort for these. The answers may also be useful to other readers, if somebody knows these.

(1) If I need the core data managed object context, is it bad to use

#import "myAppDelegate.h"
//farther down in the code:
NSManagedObjectContext *context = [(myAppDelegate.h*)[[UIApplication sharedApplication] delegate] managedObjectContext];

as opposed to leaving the warning you get if you don’t cast the delegate?

(2) What is the cheapest way to hard-code a string? I have been using

return @"myString";

on occasion in some functions where I need to pass it to a variety of places, is it better to do it this way:

static NSString *str = @"myString";
return str;

(3) How costly is it to subclass an object i wrote vs. making a new one, in general?

(4) When I am using core data and navigating through a hierarchy of some sort, is it necessary to turn things back into faults somehow after I read some info from them? or is this done automatically?

  • 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-13T23:36:07+00:00Added an answer on May 13, 2026 at 11:36 pm

    1) Casting your delegate doesn’t change anything at runtime, all it does is prevent the compiler from producing a warning. The word “costly” does not apply.

    2) @"Foo" represents a pointer to an NSString object whose contents are ‘Foo’. If there is such a string already in memory, it will be used; otherwise, a new one is created.

    NSString *fooStr = @"Foo"; will place a pointer to the ‘Foo’ string into the variable fooStr

    The static keyword changes the scope of the variable but otherwise has no performance effect (see this question on static variables for more info).

    3) “Making a new object” would mean subclassing NSObject. You can’t get away from subclassing, and the only cost difference is the memory footprint of the class you’re inheriting from.

    4) You should not worry about faults. Let core data take care of it all for you. It owns the life cycle of managed objects and handles all the memory management and faulting.

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

Sidebar

Related Questions

I've been having this really annoying thing happen the past few days, that has
I'm really frustrated with this one. A few weeks ago I got it working
I've seen a few questions that were similar but not specific enough. This one
I've seen a few questions similar to this one, but none of them have
Hey everyone, this seems like it should be a simple one; I really hope
I've read a few related questions, but none of them really helps me. So,
So I have been through most of the questions here. Also quite a few
I know there are quite a few questions on this already and i've looked
I really haven't found any related questions and I am shaking too much to
Ok, I'm really pulling my hair out on this and have tried a few

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.