-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable OptimizedFunctionsWithoutUnpacking sniff #89
Conversation
a49a59e
to
d817715
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Majkl578 this one looks quite interesting! How would it behave with something like:
$args = [10, 'testing'];
echo sprintf('blah blah %d blah: %s', ...$args);
Any form of unpacking kills the optimization. sprintf() is not on the list so it's not affected. Your example is a candidate for vsprintf(). :) |
@Majkl578 TIL, thanks 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👎 from me: a single array_merge(...$arrays)
is still more efficient than looping and applying the function, and the optimisation is less relevant than the actual variadic call.
'array_key_exists',
'array_slice',
'boolval',
'call_user_func',
'call_user_func_array',
'chr',
'count',
'doubleval',
'defined',
'floatval',
'func_get_args',
'func_num_args',
'get_called_class',
'get_class',
'gettype',
'in_array',
'intval',
'is_array',
'is_bool',
'is_double',
'is_float',
'is_long',
'is_int',
'is_integer',
'is_null',
'is_object',
'is_real',
'is_resource',
'is_string',
'ord',
'strlen',
'strval', |
That would still mean that (if it gets compiled), this rule still applies. Besides |
If it gets compiled, it’ll make sense to whitelist it. |
I don't understand? This sniff will only report usage of
Hopefully, in this case the rule will be harmless. 😊 |
As long as the list doesn't expand without BC breaks, this is 👍
…On Mon, 24 Sep 2018, 01:39 Michael Moravec, ***@***.***> wrote:
That would still mean that (if it gets compiled), this rule still applies.
I don't understand? This sniff will only report usage of ... for
functions from the list above, because unpacking defeats VM optimization.
You are free to use variadics with any other function.
I don't think any of these make any sense with variadic arguments
Hopefully, in this case the rule will be harmless. 😊
—
You are receiving this because your review was requested.
Reply to this email directly, view it on GitHub
<#89 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAJakNP62_SAMDZdZYONRQUuDxECC7ftks5ueBuvgaJpZM4W1kdE>
.
|
From readme: