perl5ever has asked for the wisdom of the Perl Monks concerning the following question:
E.g., does perl avoid copying of data in the following cases?
sub large_array { my @large_array; ...populate @large_array... return @large_array; } sub large_array_ref { my $large_array_ref = []; ...populate @$large_array_ref... return $large_array_ref; } # Is the returned array copied? @c = large_array(); @c = @{ large_array_ref() };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: returning large arrays from functions
by BrowserUk (Patriarch) on Nov 18, 2010 at 19:23 UTC | |
by LanX (Saint) on Nov 19, 2010 at 16:45 UTC | |
|
Re: returning large arrays from functions
by ikegami (Patriarch) on Nov 18, 2010 at 20:15 UTC | |
by Anonymous Monk on Nov 19, 2010 at 06:54 UTC | |
by ikegami (Patriarch) on Nov 19, 2010 at 07:55 UTC | |
by Anonymous Monk on Nov 19, 2010 at 08:14 UTC | |
by ikegami (Patriarch) on Nov 19, 2010 at 08:22 UTC | |
| |
|
Re: returning large arrays from functions
by locked_user sundialsvc4 (Abbot) on Nov 18, 2010 at 21:03 UTC | |
|
Re: returning large arrays from functions
by CountZero (Bishop) on Nov 18, 2010 at 22:51 UTC |