Suppose I have two methods of a class, each performing the same function with the same code, the only difference being the way they return a value. One is defined function get_data() {...} and returns a value. The other is defined function &get_data() {...} and returns a reference to the value.
If the code in these methods fetches a large number of database records and puts them to an associative array, would it be more memory and CPU efficient to pass the results by value or by reference?
Anyone know a good utility I could use to profile the efficiency of a function?
If the code in these methods fetches a large number of database records and puts them to an associative array, would it be more memory and CPU efficient to pass the results by value or by reference?
Anyone know a good utility I could use to profile the efficiency of a function?