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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T14:36:27+00:00 2026-06-10T14:36:27+00:00

I usually do option B as it allows me to do some debugging on

  • 0

I usually do option B as it allows me to do some debugging on the dictionary if I need to (as shown in option C). It also looks cleaner in my opinion.
This might probably be a non-issue but I’m wondering if options B or C use more memory or if there is even something else to consider when doing this in iOS programming. By the way, I’m using ARC.

Is there an advantage on using option A as opposed to option B or C?

// OPTION A
NSString *someString = [[self grabDictionaryFromDB] objectForKey:@"someField"];

// OPTION B
NSDictionary *dbRow = [self grabDictionaryFromDB]; // dbRow ONLY gets used in the next line
NSString *someString = [dbRow objectForKey:@"someField"];

// OPTION C
NSDictionary *dbRow = [self grabDictionaryFromDB]; // dbRow ONLY gets used in the next two lines
NSLog(@"Row: %@", dbRow);
NSString *someString = [dbRow objectForKey:@"someField"];
  • 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-10T14:36:29+00:00Added an answer on June 10, 2026 at 2:36 pm

    Chances are that options A and B will be optimized into exactly the same output by the compiler, so the only thing that you gain with option B is readability. Option C will likely require an extra store instruction and a pair of [retain] / [release] from the ARC, but you would not notice the impact compared to options A or B.

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

Sidebar

Related Questions

Usually (if not always), when jQuery allows you to add a callback to some
I'd usually prefer to create virtualenvs with --no-site-packages option for more isolation, and also
Usually I use $("#id").val() to return the value of the selected option, but this
We need to prepare part of our EAR for deployment, we usually do this
In my vimrc I set cpoptions+=n. Usually this option stays enabled, but as soon
I usually have the tw=80 option set when I edit files, especially LaTeX sources.
Almost every ios app now has something like Feed option. Programming that usually includes
Usually I worked with PostgreSQL and never had a problem, but now I need
I know, I know... Eric Lippert's answer to this kind of question is usually
When using VIM's incremental search option I usually search and after I got to

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.