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

  • Home
  • SEARCH
  • 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 587627
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:13:56+00:00 2026-05-13T15:13:56+00:00

I have a section of my program that contains a large amount of math

  • 0

I have a section of my program that contains a large amount of math with some rather long equations. Its long and unsightly and I wish to replace it with a function. However, chunk of code is used an extreme number of times in my code and also requires a lot of variables to be initialized.

If I’m worried about speed, is the cost of calling the function and initializing the variables negligible here or should i stick to directly coding it in each time?

Thanks,

-Faken

  • 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-13T15:13:56+00:00Added an answer on May 13, 2026 at 3:13 pm

    Most compilers are smart about inlining reasonably small functions to avoid the overhead of a function call. For functions big enough that the compiler won’t inline them, the overhead for the call is probably a very small fraction of the total execution time.

    Check your compiler documentation to understand it’s specific approach. Some older compilers required or could benefit from hints that a function is a candidate for inlining.

    Either way, stick with functions and keep your code clean.

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

Sidebar

Related Questions

i have a simple C program that uses CRITICAL_SECTION. for some reason it seem
I have a section of a Fortran90 program that should be parallelized with OpenMP.
I have a parrallelized C++ program that does brute force optimization. For some reason
I have a section on my website that when a user clicks I would
I have a section of a website that has three divs next to each
I have a section of code that can be summarised as follows; void MyFunc()
I have a section of my application that allows for people to send an
I have a section of code that I need to remove from multiple files
I have a program that has items with 3 attributes. Name(String) : Count(String) :
I have a C++ program that crashes on an access violation when I run

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.