Re: Add a zend_qsort_r/zend_qsort implementation
| From: | Levi Morrison | Date: | Thu, 10 Jan 2013 23:34:29 +0000 |
| Subject: | Re: Add a zend_qsort_r/zend_qsort implementation | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-64836@lists.php.net to get a copy of this message | ||
On Thu, Jan 10, 2013 at 2:59 PM, Stas Malyshev <smalyshev@sugarcrm.com> wrote:
>> We could export zend_qsort_r starting in 5.5; I need it ext/standard so
>> it need not be exported, which would be problematic on a stable branch.
>> It's undefined behavior because the comparison function is being called
>> with one extra pointer argument. This is the same technique glibc uses
>> though, so it should be safe. I could not find any measurable
>> performance penalty.
>
> I think this is OK for 5.5, but I'm kind of worried about the function
> parameter mismatch. PHP is run on all kinds of platforms, including
> those where glibc is never heard of :) Are we sure it's safe on all
> platforms to do this?
I urge you to be very careful. I compile PHP on intel compilers and
have seen some performance benefit to doing so. Make sure it is
cross-platform, please.