Skip to content

Conversation

@lencioni
Copy link
Contributor

In a project where I have import/no-unresolved enabled, I get the
following results with ESLint's TIMING=1 environment variable enabled:

Rule                          | Time (ms) | Relative
:-----------------------------|----------:|--------:
import/no-unresolved          | 18563.065 |    40.6%
react/sort-comp               |  1621.646 |     3.5%
no-irregular-whitespace       |  1386.958 |     3.0%
react/prop-types              |  1197.552 |     2.6%
no-implied-eval               |   829.967 |     1.8%
react/jsx-uses-vars           |   765.702 |     1.7%
keyword-spacing               |   765.665 |     1.7%
no-eval                       |   578.730 |     1.3%
semi-spacing                  |   549.684 |     1.2%
no-whitespace-before-property |   477.285 |     1.0%

To speed up this outlier, I decided to cache the results of file
existence checks in a Map. Adding this cache brings this time down
from ~18s to ~13s:

Rule                    | Time (ms) | Relative
:-----------------------|----------:|--------:
import/no-unresolved    | 13199.978 |    32.5%
react/sort-comp         |  1793.781 |     4.4%
react/prop-types        |  1400.975 |     3.4%
no-irregular-whitespace |  1315.485 |     3.2%
react/jsx-uses-vars     |   794.097 |     2.0%
no-implied-eval         |   765.593 |     1.9%
keyword-spacing         |   752.945 |     1.9%
no-eval                 |   592.048 |     1.5%
semi-spacing            |   532.061 |     1.3%
no-control-regex        |   479.856 |     1.2%

Addresses #187

In a project where I have import/no-unresolved enabled, I get the
following results with ESLint's TIMING=1 environment variable enabled:

```
Rule                          | Time (ms) | Relative
:-----------------------------|----------:|--------:
import/no-unresolved          | 18563.065 |    40.6%
react/sort-comp               |  1621.646 |     3.5%
no-irregular-whitespace       |  1386.958 |     3.0%
react/prop-types              |  1197.552 |     2.6%
no-implied-eval               |   829.967 |     1.8%
react/jsx-uses-vars           |   765.702 |     1.7%
keyword-spacing               |   765.665 |     1.7%
no-eval                       |   578.730 |     1.3%
semi-spacing                  |   549.684 |     1.2%
no-whitespace-before-property |   477.285 |     1.0%
```

To speed up this outlier, I decided to cache the results of file
existence checks in a Map. Adding this cache brings this time down
from ~18s to ~13s:

```
Rule                    | Time (ms) | Relative
:-----------------------|----------:|--------:
import/no-unresolved    | 13199.978 |    32.5%
react/sort-comp         |  1793.781 |     4.4%
react/prop-types        |  1400.975 |     3.4%
no-irregular-whitespace |  1315.485 |     3.2%
react/jsx-uses-vars     |   794.097 |     2.0%
no-implied-eval         |   765.593 |     1.9%
keyword-spacing         |   752.945 |     1.9%
no-eval                 |   592.048 |     1.5%
semi-spacing            |   532.061 |     1.3%
no-control-regex        |   479.856 |     1.2%
```

Addresses import-js#187
@lencioni lencioni force-pushed the cache-file-exists branch from f4a1616 to 5df6c55 Compare March 17, 2016 22:23
@benmosher
Copy link
Member

This is awesome, thanks! I hadn't thought to look at this. I need to double check some things with cache correctness for eslint_d and eslint-loader, but I'll merge + publish ASAP!

@benmosher benmosher added this to the minor milestone Mar 18, 2016
@benmosher benmosher merged commit 5df6c55 into import-js:master Mar 18, 2016
@lencioni lencioni deleted the cache-file-exists branch March 18, 2016 21:32
@benmosher benmosher modified the milestones: v1.2.0, minor Mar 19, 2016
stephenjason89 pushed a commit to stephenjason89/eslint-plugin-import that referenced this pull request May 17, 2025
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.

2 participants