Re: Re: qsort fix
| From: | Jim Winstead | Date: | Mon, 31 May 1999 23:01:23 +0000 |
| Subject: | Re: Re: qsort fix | ||
| References: | 1 2 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-6339@lists.php.net to get a copy of this message | ||
On May 30, Rasmus Lerdorf wrote:
> > Since the only point of non-deterministic comparison would be for
> > shuffle(), and since shuffle() should really be done with something linear
> > rather than qsort which is O(n log n)...
> >
> > Wouldn't it be better to leave qsort alone and change shuffle()?...
>
> Well, we also want to eliminate any possible ways that users can crash
> PHP. Short of writing some sort of comparison function tester, we can't
> know whether the user suuplied a non-deterministic comparison function or
> not. We can document that they should, but if they don't and they core
> PHP, we have a problem. So I do think we need to fix this.
Sounds like a good reason to me. (I knew there was on there somewhere.)
And for something like shuffle(), it's arguably a good thing if it
is worse than O(n) because it will shuffle it that much more. :)
Jim