GrahamS Posted January 27, 2004 Share Posted January 27, 2004 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 More sharing options...
Valik Posted January 27, 2004 Share Posted January 27, 2004 ByRef uses the original variable, no copy is performed. Otherwise, a local (to the function) copy is created for the scope of the function and is destroyed when the function exits. Link to comment Share on other sites More sharing options...
GrahamS Posted January 27, 2004 Author Share Posted January 27, 2004 Thanks for the quick reply! GrahamS Link to comment Share on other sites More sharing options...
Administrators Jon Posted January 27, 2004 Administrators Share Posted January 27, 2004 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) Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
GrahamS Posted January 27, 2004 Author Share Posted January 27, 2004 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now