Re: Slow references?
| From: | Rasmus Lerdorf | Date: | Mon, 14 Jan 2002 02:29:28 +0000 |
| Subject: | Re: Slow references? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-80406@lists.php.net to get a copy of this message | ||
copies are faster if you don't change the copied data since no copy is
actually done. It is a shallow copy also know as a copy-on-write so you
should just pass a copy in your case, I bet.
-Rasmus
On Mon, 14 Jan 2002, Tino Didriksen wrote:
> Is it just me, or is working with references slow?
>
> I have functions that loop through about 10000 lines of text, generating
> stats on the content.
>
> When I pass the lines to the function normally, this takes 0.8 seconds.
> Passing by reference, or as a reference, both increase the time to 6
> seconds.
>
> Meaning that working with references takes 750% the time.
>
> In my head, making a copy should be slowest, but apparently referencing is
> far slower...
> Am I missing a point anywhere?
>
> --|--
> Tino Didriksen
> http://ProjectJJ.dk/
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>