Skip to content
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

Added fast isset() path to token->equals() #4041

Closed
wants to merge 70 commits into from

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Oct 14, 2018

looking up the existance of a property via isset() is waaaaay faster then array_key_exists().
we still need array_key_exists() as a fallback, when properties exist with a null-value to work properly. this case is very rare, therefore this can be considered a speedup.

this change speeds up php-cs-fixer by 5.6%.

image

keradus and others added 30 commits June 8, 2018 21:28
# Conflicts:
#	src/Console/Application.php
* 2.12:
  Fix typos in changelog
…or ext-mbstring aliasses (SpacePossum)

This PR was squashed before being merged into the 2.13-dev branch (closes PHP-CS-Fixer#3841).

Discussion
----------

NoAliasFunctionsFixer - add opt in option for ext-mbstring aliasses

closes PHP-CS-Fixer#3840

Commits
-------

5120a08 NoAliasFunctionsFixer - add opt in option for ext-mbstring aliasses
* 2.12:
  Update integrations tests
* 2.12:
  "yield from" as keyword
…e as "count". (SpacePossum)

This PR was merged into the 2.13-dev branch.

Discussion
----------

PhpUnitDedicateAssertFixer - fix "sizeOf" same as "count".

@ see PHP-CS-Fixer#3785 (comment)

Commits
-------

67d4f8c PhpUnitDedicateAssertFixer - fix "sizeOf" same as "count".
* 2.12:
  Update composer.json
  Fix priority between PHPDoc return type fixers
…fix strategy (SpacePossum)

This PR was merged into the 2.13-dev branch.

Discussion
----------

BinaryOperatorSpacesFixer - Add "no space" fix strategy

closes PHP-CS-Fixer#3827

also prepares for merging the `space around concat` fixers into the BinaryOperatorSpacesFixer

Commits
-------

9fa2263 BinaryOperatorSpacesFixer - Add "no space" fix strategy
* 2.12:
  SpaceAfterSemicolonFixer - loop over all tokens
* 2.12:
  Add install/update using PHIVE instructions to README
* 2.12:
  NativeConstantInvocationFixer - better constant detection
# Conflicts:
#	src/Console/Application.php
* 2.12:
  Add priority to AlignMultilineCommentFixer
* 2.12:
  ArrayIndentFixer - Don't indent empty lines
* 2.12:
  NoExtraBlankLinesFixer - remove blank lines after open tag
* 2.12:
  StrictParamFixer - make it case-insensitive
* 2.12:
  PhpdocNoEmptyReturnFixer - fix docs
* 2.12:
  FunctionsAnalyzer - false positive for constant and function definition
* 2.12:
  DX: simplifying return expression in FunctionsAnalyzer
Symfony wants this fixer applied for compiler-optimized functions.
…he Symfony:risky ruleset (stof)

This PR was merged into the 2.13-dev branch.

Discussion
----------

Add the native_function_invocation fixer in the Symfony:risky ruleset

Symfony wants this fixer applied for compiler-optimized functions (we were the ones requesting the feature).

Commits
-------

8556bee Add the native_function_invocation fixer in the Symfony:risky ruleset
* 2.12:
  DX: cleanup - remove special treatment for PHP <5.6
keradus and others added 22 commits August 20, 2018 00:15
# Conflicts:
#	.php_cs.dist
# Conflicts:
#	src/Console/Application.php
This PR was squashed before being merged into the 2.13-dev branch (closes PHP-CS-Fixer#3886).

Discussion
----------

Add PhpUnitMethodCasingFixer

Closes PHP-CS-Fixer#3302
```diff
 class MyTest extends \PhpUnit\FrameWork\TestCase
 {
-    public function test_my_code() {}
+    public function testMyCode() {}
 }
```

- [x] Implement base fixer
- [x] Take care of `@depends`
- [x] Run after `PhpUnitTestAnnotationFixer`
- [x] Deprecate `PhpUnitTestAnnotationFixer` *case* config

Commits
-------

b87f254 Add PhpUnitMethodCasingFixer
…SpacePossum)

This PR was merged into the 2.13-dev branch.

Discussion
----------

Add FopenFlagOrderFixer & FopenFlagsFixer

closes PHP-CS-Fixer#3417

ping @ntzm , hope you can help me out with:
- define the order of all flags
- ~do we want to have an option to remove flags when found, like `t`~
- ~do we want to have an option to add flags when not found, like `b`~

Commits
-------

8682d86 Add FopenFlagOrderFixer & FopenFlagsFixer
This PR was squashed before being merged into the 2.13-dev branch (closes PHP-CS-Fixer#3979).

Discussion
----------

DX: enable php_unit_method_casing

Appendix for PHP-CS-Fixer#3886

Commits
-------

3fff21a DX: enable php_unit_method_casing
This PR was merged into the 2.13-dev branch.

Discussion
----------

Add MagicMethodCasingFixer

```
$ php php-cs-fixer describe magic_method_casing
Description of magic_method_casing rule.
Magic method definitions and calls must be using the correct casing.

Fixing examples:
 * Example PHP-CS-Fixer#1.
   ---------- begin diff ----------
   --- Original
   +++ New
   @@ -1,7 +1,7 @@
    <?php
    class Foo
    {
   -    public function __Sleep()
   +    public function __sleep()
        {
        }
    }

   ----------- end diff -----------

 * Example PHP-CS-Fixer#2.
   ---------- begin diff ----------
   --- Original
   +++ New
   @@ -1,2 +1,2 @@
    <?php
   -$foo->__INVOKE(1);
   +$foo->__invoke(1);

   ----------- end diff -----------

```

Commits
-------

e45919f Add MagicMethodCasingFixer
This PR was squashed before being merged into the 2.13-dev branch (closes PHP-CS-Fixer#3826).

Discussion
----------

Add CombineNestedDirnameFixer

Input:

```php
dirname(dirname(dirname($path)));
```

is fixed to:

```php
dirname($path, 3);
```

(Requires PHP >= 7.0)

Commits
-------

398f343 Add CombineNestedDirnameFixer
This PR was squashed before being merged into the 2.13-dev branch (closes PHP-CS-Fixer#3907).

Discussion
----------

Add ImplodeCallFixer

Resolves PHP-CS-Fixer#3904

Adding to `@Symfony` rule set was suggested by @keradus.

Commits
-------

f063eae Add ImplodeCallFixer
* 2.12:
  Clarifies allow-risky usage
looking up the existance of a property via isset() is waaaaay faster then array_key_exists().
we still need array_key_exists() as a fallback, when properties exist with a null-value to work properly. this case is very rare, therefore this can be considered a speedup.
@staabm
Copy link
Contributor Author

staabm commented Oct 15, 2018

(Try a rebuild)

@staabm staabm changed the base branch from master to 2.12 October 16, 2018 17:15
@staabm
Copy link
Contributor Author

staabm commented Oct 16, 2018

re-submitted with new merge-base

#4046

@staabm staabm closed this Oct 16, 2018
@staabm staabm deleted the fast-equals branch October 16, 2018 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants