Jump to content

Parameter Efficiency


GrahamS
 Share

Recommended Posts

I am concerned about the efficiency of passing large data structures as parameters to functions. Am I right in assuming that passing a parameter by reference (i.e. using the ByRef keyword) will not perform a copy? If the parameter is passed without the ByRef keyword is a copy performed?

Thanks in anticipation

GrahamS

Link to comment
Share on other sites

  • Administrators

Unless you have a good reason not to, always pass arrays by reference - the performance difference is massive (hence why not many languages allow you to pass arrays any other way)

Link to comment
Share on other sites

That's why I wanted confirmation about my assumption.

Would it not be a good idea to add this to the help file?

BTW I once was called in to troubleshoot a hard real time project, written in C, that had major performance problems. They were passing 1400 byte messages by value, up to 50 times per message! The fix gained an order of magnitude improvement.

GrahamS

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...