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

[Fix] no-restricted-paths: enhance performance for exceptions #2022

Merged
merged 1 commit into from May 12, 2021

Conversation

malykhinvi
Copy link
Contributor

@malykhinvi malykhinvi commented Apr 2, 2021

Main changes
Move exceptions paths resolution and validation to rule create phase.

Background
There was a performance downgrade if zone had except option defined. On every import every relative exception path had to be resolved to absolute path and validated. See a corresponding issue #1758

Results
On our SPA we have a lot of zones with exceptions. It turned out that this simple change gives us almost 10 times better performance. Measured with TIMING=1 eslint on our project.

Before:

Rule                                    | Time (ms) | Relative
:---------------------------------------|----------:|--------:
import/no-restricted-paths              | 94633.358 |    72.2%
@typescript-eslint/no-floating-promises | 18576.419 |    14.2%
react/no-multi-comp                     |  4629.594 |     3.5%
@typescript-eslint/no-redeclare         |  2634.454 |     2.0%
lodash/callback-binding                 |  1272.849 |     1.0%
@typescript-eslint/naming-convention    |  1209.871 |     0.9%
lodash/collection-return                |   885.415 |     0.7%
lodash/no-unbound-this                  |   669.923 |     0.5%
lodash/collection-method-value          |   668.716 |     0.5%
lodash/no-extra-args                    |   569.119 |     0.4%

After:

Rule                                    | Time (ms) | Relative
:---------------------------------------|----------:|--------:
@typescript-eslint/no-floating-promises | 18438.043 |    40.6%
import/no-restricted-paths              |  8910.373 |    19.6%
react/no-multi-comp                     |  4617.370 |    10.2%
@typescript-eslint/no-redeclare         |  2697.734 |     5.9%
lodash/callback-binding                 |  1282.186 |     2.8%
@typescript-eslint/naming-convention    |  1177.818 |     2.6%
lodash/collection-return                |   885.509 |     1.9%
lodash/collection-method-value          |   727.829 |     1.6%
lodash/no-unbound-this                  |   681.466 |     1.5%
lodash/no-extra-args                    |   606.288 |     1.3%

@coveralls
Copy link

coveralls commented Apr 2, 2021

Coverage Status

Coverage increased (+13.0%) to 84.048% when pulling 17a445d on malykhinvi:master into 359b6e5 on benmosher:master.

@malykhinvi malykhinvi changed the title [Fix] no-restricted-paths: enhance performance for exceptions [no-restricted-paths]: enhance performance for exceptions Apr 2, 2021
@malykhinvi malykhinvi marked this pull request as ready for review April 2, 2021 06:21
@ljharb ljharb changed the title [no-restricted-paths]: enhance performance for exceptions [Fix] no-restricted-paths: enhance performance for exceptions May 12, 2021
Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, seems reasonable!

@ljharb ljharb merged commit 17a445d into import-js:master May 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants