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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:51:53+00:00 2026-06-04T21:51:53+00:00

Are there performance implications when using pointers? Is it better to avoid using pointers

  • 0

Are there performance implications when using pointers?

Is it better to avoid using pointers and if so, under what circumstances? Obviously they help, along with references, to reduce data copying. I presume if the data type being pointed to is small, the need for a pointer is smaller. In contrast, it is better to pass a large object via pointer as the overhead of the pointer is smaller than the overhead of copying the object.

I was also wondering about pointers in areas other than arguments/parameters?

Are references generally better than pointers in this performance context?

I appreciated I am bordering on the SO “dirty” topic of micro-optimizations but I am writing a very latency-focussed app.

  • 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-04T21:51:54+00:00Added an answer on June 4, 2026 at 9:51 pm

    I know that performance can be important, but semantics are more important: fast and wrong is useless.

    Using pointers or references have semantics implications, such as sharing:

    void foo(A& a) {
        a.a = 1;
        if (a.b != 0) { throw ... }
        a.b = 0;
    }
    

    In the case a.b == 0, then the first field of a has been changed but not its second.

    Also, such sharing may create potential aliasing:

    void foo(struct A a, struct A b);
    
    void foo(struct A* a, struct A* b);
    

    In the first case, the two structures are necessarily distinct, but in the latter they are not. This possible aliasing might prevent optimizations.

    Focus on semantics first. Once you get them right, you can tweak and measure the effects in your particular situation.

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

Sidebar

Related Questions

I realize that, generally speaking, there are performance implications of using reflection. (I myself
I was wondering if there were any performance implications between using TPL TaskFactory.FromAsync and
What kind of performance implications are there to consider when using try-catch statements in
Are there any performance/other implications in having an object relates to itself? (self join)
I was wondering what the performance implications are of using std::time(0) to seed random
When using loadable modules such as geoip, is there a performance hit to always
What are the performance, security, or other implications of using the following form to
I wrote two methods to check there performance public class Test1 { private String
Is there any performance different between hosting your asp.net in mono on linux and
Is there any performance differences between string.Format and String.Format ? As far as i

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.