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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:23:53+00:00 2026-06-10T05:23:53+00:00

I have a Fortran code like this: file1.f90 program myprog use func1mod do i=1,N

  • 0

I have a Fortran code like this:

file1.f90

program myprog
 use func1mod
    do i=1,N
       call subroutine1
    enddo
    subroutine subroutine1
         integer*8::var1,var2,var3,...
         do j=1,N
            x=func1(var1,var2,var3,..)
            computations based on x
         enddo
    return
    end
end 

file2.f90

 module func1mod
 contains
     func1(var1,var2,var3,....)
         func1=some computations based on var1, var2, var3, ...
      return
     end function func1
 end module func1mod

function func1 does not modify any of its arguments. It computes a value based on the arguments and returns a value. The # of arguments is large but the function is less than 30 lines of code. What is the best approach to reduce the function call overhead.
One approach would be to inline the function. Is there any other way out?

  • 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-10T05:23:55+00:00Added an answer on June 10, 2026 at 5:23 am

    The best you can do is be as explicit as possible about the semantics of the function, turn optimization up as high as possible, and let the compiler make the best decision it can about how best to implement the call. Make sure the dummy variables are marked intent(in), and mark the function as pure – although if it’s only 30 lines, the compiler will doubtless notice these things anyway at high optimization – and check your compiler options to see if there’s anything you can do to encourage (for instance) inlining.

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

Sidebar

Related Questions

I have a legacy fortran code with many statements like 'goto 50'. I was
I had some fortran code that looked something like: subroutine foo(mx,my,mz) real pts(3,mx,my,mz) end
I have some routines written in fortran that I'd like to use in my
Hi I am trying to use fortran structure like this type some u !
I have the following FORTRAN code which I need to convert to C or
I have a fortran (unmanaged code) dll as the calculation engine, and a C#
I've been starting to use Fortran (95) for some numerical code (generating python modules).
I have a Fortran subroutine which uses BLAS' subroutines dgemm, dgemv and ddot, which
Is there anything like Javadoc for documenting Fortran code? How does one document the
I'm writing code that will call a C function from Fortran using Fortran's C

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.