ud
then include/require files that define global constants before compiling files
that contain those constants, thereby propagating their values throughout the
code base during preloading. That would eliminate a lot of the runtime cost of
(not so truly constant) constants.
Please let me know your
Thoughts?
--
Benjamin Coutu
ben.co...@zeyos.com
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
only call `time(NULL)` when
`!ZEND_NUM_ARGS()`.
Can someone please make the appropriate change? Please apologize, but I simply
review code and do not have a proper C development setup that allows me to
supply patches or create pull requests.
Thanks,
Ben
--
Benjamin Coutu
http://www.zeyos.com
: Nikita Popov
Date: Fri, 27 Oct 2017 18:34:15 +0200
Subject: Re: [PHP-DEV] Apply substr() optimization to array_slice()
>
>
> On Fri, Oct 27, 2017 at 12:10 PM, Nikita Popov wrote:
> > On Fri, Oct 27, 2017 at 4:16 PM, Sara Golemon wrote:
> >>
> >> On Fri, Oct 27
Hello everyone,
Please consider these two statements:
substr($string, 0, $length);
array_slice($array, 0, $length, true);
Currently, with substr(), if $offset is zero and $length is smaller or equal to
the original string length we just increase the reference count of the original
string and r
6/7/2017 7:15 PM, Benjamin Coutu wrote:
> > Hi Dmitry,
> >
> > I just noticed that all basic string comparison functions in
> > Zend/zend_builtin_functions.c, especially "strcmp", "strncmp",
> > "strcasecmp", "strncasecmp" st
ecmp", etc. at least as
important as "substr_compare", especially considering that these are wrappers
around very basic functions that often get called in very hot code or inside
tight loops (e.g. sorting). I therefore recommend changing those 4 functions in
Zend/zend_builtin_func
== Original ==
From: Levi Morrison
To: Benjamin Coutu
Date: Thu, 03 Nov 2016 13:23:23 +0100
Subject: Re: [PHP-DEV] Algorithmic efficiency of zend_memrchr
>
>
> On Thu, Nov 3, 2016 at 5:21 AM, Benjamin Coutu wrote:
> > Hello everyone,
> >
> > I think there ar
rther?
Cheers,
Benjamin Coutu
--
Bejamin Coutu
ben.co...@zeyos.com
ZeyOS, Inc.
http://www.zeyos.com
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
Ouch, forgot my powers of two there during a weak moment - what a careless
mistake. Sorry about that!
Given the low entropy I highly doubt this to be of much benefit.
== Original ==
From: Lauri Kenttä
To: Benjamin Coutu
Date: Thu, 27 Oct 2016 17:12:15 +0200
Subject: Re: [PHP
o, no need to ever unpack if we can
guarantee that all eligible strings are converted to packed format before usage)
Let me know if you (or anyone else) is interested in discussing this approach
further.
Cheers,
Benjamin Coutu
== Original ==
From: Benjamin Coutu
To: Nikita Popov
loops. This would not entail any overhead on write. What do you
think?
Cheers,
Benjamin
== Original ==
From: Dmitry Stogov
To: Benjamin Coutu , Xinchen Hui ,
Nikita Popov , Joe Watkins , "Bob
Weinand" , Andrea Faulds
Date: Wed, 19 Oct 2016 18:02:53 +0200
Subject:
Hello everyone,
I've identified a few more array/hash use cases where it might make sense to
introduce special short circuit logic for packed arrays.
Specifically, there is an additional property of certain packed arrays (apart
from being packed obviously) that we can utilize: A packed array wi
Hello everyone,
I was wondering if it would make sense to store small strings (length <= 7)
directly inside the zval struct, thereby avoiding the need to extra allocate a
zend_string, which would also not entail any costly indirection and refcounting
for such strings.
The idea would be to add
Hi Xinchen,
There is still a way we could make this work, if we'd simply check for nNumUsed
== nNumOfElements as well. Because a packed array with nNumUsed equal to
nNumOfElements must be consecutively indexed from zero onward without any gaps
(no IS_UNDEF).
I therefore propose to change array
Hello Xinchen,
Thanks for changing array_pad and array_rand accordingly, that's very good.
I noticed a small improvement we could make to array_slice for the packed case:
We can change line 3003:
if ((Z_ARRVAL_P(input)->u.flags & HASH_FLAG_PACKED) && !preserve_keys)
=>
if ((Z_ARRVAL_P(input)->u.
Hello Xinchen,
I have noticed two more cases where we could easily use packed arrays.
1. array_merge($packed1, $packed2, ...):
In the quite common case where all arguments are packed arrays, the resulting
array can also be a packed array (as per documentation: "if the input arrays
[...] contai
Hi Xinchen,
The code I used was simply derived from the code of the array_slice
implementation (totally analogous).
Maybe your suggested changes (check HASH_FLAG_PACKED fist + Z_TRY_ADDREF)
should be carried over to array_slice then as well.
Please go ahead and commit a patch, I'd prefer to sti
Hello Xinchen,
Analogue to the array_slice implementation, the array_reverse function could
also be optimized for packed hash tables when preserve_keys is false (most
common).
The following patch should do just that:
if (!preserve_keys && (Z_ARRVAL_P(input)->u.flags & HASH_FLAG_PACKED)) {
Hello everyone,
While reviewing the array.c code base, I have noticed that the array_multisort
function still uses the old zend_qsort instead of the new zend_sort algorithm
that was introduced with PHP 7.
That represents a clear inconsistency, because all other array sorting
functions utilize
Hello everyone,
(Un)fortunately I do not have voting rights, but here is my (freely expressed)
50 cents anyways:
I appreciate that Andrea is trying to come up with a one-size-fits-all RFC.
Nevertheless I believe it is flawed in regards to content as well as formally
in terms of voting options.
e, probably
OpCache is not enabled or optimization flags are not properly set. Please see
http://php.net/manual/en/book.opcache.php for more info.
Cheers,
Benjamin Coutu
== Original ==
From: Oleg Serov
To: internals@lists.php.net
Date: Sun, 08 Feb 2015 00:13:05 +0100
Subject: [PHP-D
ly the way to go.
Thanks,
Ben
== Original ==
From: Dmitry Stogov
To: Benjamin Coutu
Date: Mon, 02 Feb 2015 06:53:20 +0100
Subject: [PHP-DEV] Re: Improvements to array.c code base
Hi Benjamin,
We are in the state, when we mainly have to concentrate on big improvements
that
Hi Dmitry,
Thank you for picking up on our proposal. RFC and patch look promising -
awesome work!
I am looking forward to it.
Ben
== Original ==
From: Dmitry Stogov
To: PHP Internals
Date: Fri, 30 Jan 2015 08:23:19 +0100
Subject: [PHP-DEV] [RFC] Fix "foreach" behavior
Hi,
I'
se it is only used for userland
arrays, not other hash tables (such as object properties or internal structures
that build upon the hashtable struct).
Thanks,
Ben
== Original ==
From: Nikita Popov
To: Benjamin Coutu
Date: Thu, 22 Jan 2015 10:53:19 +0100
Subject: Re: [PH
CPU cache misses instead of one.
yes, the patch is here: https://github.com/laruence/php-src/tree/union-hash-key
thanks
>
> Thanks. Dmitry.
>
> On Thu, Jan 22, 2015 at 9:43 AM, Benjamin Coutu wrote:
>>
>> Hi,
>>
>> Currently a hashtable bucket has to store both, t
, because
they have their own pointer.
This would effectively speed up most for-each operations and would have the
extra benefit of not having to store an internal pointer in the hashtable
structure.
Please let me know your thoughts!
Cheers,
Ben
--
Benjamin Coutu
Zeyon Technologies
tions to extract
the correct meaning.
Please let me know your thoughts!
Cheers,
Ben
--
Benjamin Coutu
Zeyon Technologies Inc.
http://www.zeyos.com
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
Hi Dmitry,
One could use an external pointer for the iteration and flag the hashtable
while being iterated.
In order to preserve the constraint that for-each is conceptually working on a
copy, one would have to duplicate (zend_array_dup) the hastable everytime one
alters it (e.g. adding/changi
Sorry, your right of course as not preserving keys only applies to numeric
indices.
== Original ==
From: Xinchen Hui
To: Benjamin Coutu
Date: Tue, 20 Jan 2015 10:13:04 +0100
Subject: Re: [PHP-DEV] Re: Improvements to array.c code base
Hey:
On Tue, Jan 20, 2015 at 5:06 PM
FAST_ZPP: Why is it not used more often, especially in
the satndard libraries? Is there some particular drawback? I'd like to
understand.
Thanks,
Ben
== Original ==
From: Xinchen Hui
To: Benjamin Coutu
Date: Tue, 20 Jan 2015 09:53:38 +0100
Subject: [PHP-DEV] Re: Improvemen
ubiquitous! Giving it an opcode and making it part of the VM
seams reasonable.
Please let me know your thoughts.
Cheers,
Ben
--
Benjamin Coutu
Zeyon Technologies Inc.
http://www.zeyos.com
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
I wouldn't mind T_SPACESHIP, but T_THREEWAY_COMPARISON is probably more
technically precise and better than T_COMBINED_COMPARISON.
Cheers,
Ben
== Original ==
From: Jordi Boggiano
To: Andrea Faulds
Date: Mon, 19 Jan 2015 12:20:32 +0100
Subject: Re: [PHP-DEV] [RFC] Combined Comp
This would be indeed very useful and also ideal from a sorting performance
perspective!
== Original ==
From: Andrea Faulds
To: PHP internals
Date: Mon, 19 Jan 2015 09:28:17 +0100
Subject: [PHP-DEV] [RFC] Combined Comparison (Spaceship) Operator
Good morning,
This is a reboot
==
From: Dmitry Stogov
To: Benjamin Coutu
Date: Fri, 16 Jan 2015 17:12:34 +0100
Subject: Re: [PHP-DEV] Generating more efficient code for while-loop
Hi Benjamin,
Thanks for idea.
With PHP7 AST compiler, it's quite easy to implement this (it took us 15
minutes to try :)
However, it doesn
very excited! :)
--
Benjamin Coutu
Zeyon Technologies Inc.
http://www.zeyos.com
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
36 matches
Mail list logo