liferay / liferay-frontend-projects

A monorepo containing assorted Frontend Infrastructure Team projects
Other
69 stars 68 forks source link

Execution time for eslint-plugin rules #705

Closed bryceosterhaus closed 1 year ago

bryceosterhaus commented 3 years ago

To make sure we don't slow things down too much, we should add some occasional benchmarks for how long our plugin will take to run.

bryceosterhaus commented 3 years ago

Current statistics run on DXP. Run TIMING=1 yarn checkFormat at liferay-portal/modules

Rule                            | Time (ms) | Relative
:-------------------------------|----------:|--------:
react/no-direct-mutation-state  |  3710.491 |    21.4%
react/no-string-refs            |  1943.668 |    11.2%
react/require-render-return     |  1876.540 |    10.8%
@liferay/padded-test-blocks     |  1064.336 |     6.1%
no-unused-vars                  |   856.555 |     4.9%
no-redeclare                    |   791.565 |     4.6%
padding-line-between-statements |   646.989 |     3.7%
lines-around-comment            |   479.569 |     2.8%
object-shorthand                |   266.603 |     1.5%
react/jsx-fragments             |   251.262 |     1.5%

Looks like we can keep an eye on @liferay/padded-test-blocks

bryceosterhaus commented 3 years ago

Changing TIMING=100 and only looking at our rules we created

@liferay/padded-test-blocks                 |   853.190 |     5.1%
@liferay/group-imports                      |   210.337 |     1.2%
@liferay/no-abbreviations                   |   154.659 |     0.9%
@liferay/sort-imports                       |   127.968 |     0.8%
@liferay/imports-first                      |   122.316 |     0.7%
@liferay/portal/no-react-dom-create-portal  |    92.760 |     0.5%
@liferay/no-duplicate-class-names           |    54.276 |     0.3%
@liferay/portal/no-react-dom-render         |    52.975 |     0.3%
@liferay/import-extensions                  |    51.691 |     0.3%
@liferay/portal/no-global-fetch             |    50.025 |     0.3%
@liferay/portal/no-side-navigation          |    41.776 |     0.2%
@liferay/no-require-and-call                |    35.654 |     0.2%
@liferay/no-absolute-import                 |    33.574 |     0.2%
@liferay/destructure-requires               |    27.321 |     0.2%
@liferay/no-it-should                       |    24.105 |     0.1%
@liferay/sort-import-destructures           |    20.706 |     0.1%
@liferay/sort-class-names                   |    20.468 |     0.1%
@liferay/no-dynamic-require                 |    19.375 |     0.1%
@liferay/portal/deprecation                 |    17.065 |     0.1%
@liferay/trim-class-names                   |    13.770 |     0.1%
@liferay/no-duplicate-imports               |    12.754 |     0.1%
@liferay/portal/no-metal-plugins            |     9.502 |     0.1%
@liferay/no-length-jsx-expression           |     6.508 |     0.0%
@liferay/portal/no-loader-import-specifier  |     6.378 |     0.0%

Overall, performance doesn't seem very problematic

bryceosterhaus commented 3 years ago

Going to leave this issue open and periodically compare stats and post them here.

diegonvs commented 3 years ago

Would be great create a script to run in GH actions to detect:

  1. If there is a change in the scope of eslint-plugin,
  2. Run timing script
  3. stdout the new values

We can configure a threshold for it to detect anomalies like when relative is greater than 50% 🤔

What do you think?

bryceosterhaus commented 3 years ago

Yeah that seems like a good idea! We'll keep this issue open for that if we get a chance to add it down the line.

bryceosterhaus commented 1 year ago

Adding one more run for info but going to close this issue for now and we can re-open if we decide to re-visit this later

Rule Time (ms) Relative
react/no-direct-mutation-state 5147.795 19.6%
react/no-string-refs 2639.341 10.1%
react/require-render-return 2350.370 9.0%
@liferay/padded-test-blocks 1666.871 6.4%
@typescript-eslint/no-unused-vars 960.197 3.7%
notice/notice 946.635 3.6%
no-redeclare 916.350 3.5%
no-unused-vars 764.921 2.9%
padding-line-between-statements 645.805 2.5%
lines-around-comment 569.878 2.2%
react/jsx-fragments 416.278 1.6%