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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T06:37:51+00:00 2026-06-09T06:37:51+00:00

From a speed and efficiency standpoint: which is considered best-practice, create a temporary object

  • 0

From a speed and efficiency standpoint: which is considered best-practice, create a temporary object or decompose a (possibly temporary) argument object?

In this example the implementations of the functions are mutually exclusive for DRY purposes. Both WILL NOT be implemented as shown, but one will be implemented in terms of the other which will delegate the actual work.

void SetPoints(double xA, double yA, double xB, double yB, double xC, double yC);
void SetPoints(const Point& A, const Point& B, const Point& C);

///Option one: create temporary objects:
void SetPoints(double xA, double yA, double xB, double yB, double xC, double yC) {
    SetPoints(Point(xA, yA), Point(xB, yB), Point(xC, yC));
}

//Option two: decompose object arguments
void SetPoints(const Point& A, const Point& B, const Point& C) {
    SetPoints(A.GetX(), A.GetY(), B.GetX(), B.GetY(), C.GetX(), C.GetY());
}
  • 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-09T06:37:53+00:00Added an answer on June 9, 2026 at 6:37 am

    Overwhelmingly likely to be completely irrelevant. The compiler will likely not even generate different assembly for the two, and even if it did, the performance cost of a tiny thunk would be negligible. There’s no reason to even think about this.

    The best function is the one that is the most clear/etc, in this case.

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

Sidebar

Related Questions

I`m developing an application which receives data from my GPS device like coordinates, speed
For the sake of this question, let efficiency mean, more-or-less, page rendering speed. Albeit,
I am profiling my MVC app and the speed from the Performance Explorer is
I discovered https://developers.google.com/speed/pagespeed/ the other day and have improved my website's page speed from
I am running into some difficulty with the following query. SELECT maker, speed FROM
EDIT: When should and shouldn't you break away from OOP for speed/performance? might be
In Scala, is it bad, from the point of view of efficacy and speed
From my website, I have a button which calls a method and then generates
From this context: import itertools lines = itertools.cycle(open('filename')) I'm wondering how I can implement
I want to create a database structure that will has good efficiency. Now database

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.