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

New: Configurable List Size For Per-Rule Performance Metrics #66

Merged
merged 2 commits into from Oct 14, 2020
Merged

New: Configurable List Size For Per-Rule Performance Metrics #66

merged 2 commits into from Oct 14, 2020

Conversation

bmish
Copy link
Sponsor Member

@bmish bmish commented Sep 11, 2020

Summary

Running TIMING=1 eslint from the command-line outputs a list of per-rule performance metrics. The list is currently limited to the top 10 longest-running rules. We would like to enable users to see a longer list of rules if desired.

Open Questions

It was difficult choosing between the recommended design (reusing the TIMING variable) and Alternative A (adding a new TIMING_LIMIT variable). Interested to hear which one people prefer.

Related Issues

eslint/eslint#13671

@nzakas nzakas added Initial Commenting This RFC is in the initial feedback stage and removed triage labels Sep 16, 2020
Copy link
Member

@nzakas nzakas left a comment

Choose a reason for hiding this comment

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

Thanks for submitting this RFC. I can see how it would be useful to output performance information about more rules. The one thing that's missing from this RFC is the detail design, which should describe how the feature will be implemented. So far, you've done a good job of describing how the end user would make use of this change (and I do prefer staying with TIMING rather than adding another environment variable). The next step would be to dig into the code to see where you'd need to make changes and then update this RFC with those details.

@bmish
Copy link
Sponsor Member Author

bmish commented Sep 16, 2020

@nzakas thanks for the tip, I have added a code sample to the RFC.

Copy link
Member

@nzakas nzakas left a comment

Choose a reason for hiding this comment

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

Thanks. LGTM. I’d like to hear what @btmills thinks, too.

Comment on lines 52 to 60
| `eslint` | do not show |
| `TIMING=0 eslint` | show the first 10 rules (due to minimum of 10) |
| `TIMING=1 eslint` | show the first 10 rules (due to minimum of 10) |
| `TIMING=5 eslint` | show the first 10 rules (due to minimum of 10) |
| `TIMING=10 eslint` | show the first 10 rules |
| `TIMING=11 eslint` | show the first 11 rules |
| `TIMING=15 eslint` | show the first 15 rules |
| `TIMING=100 eslint` | show the first 100 rules |
| `TIMING=all eslint` | show all the rules |
Copy link
Member

Choose a reason for hiding this comment

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

Should we account for other values that cannot be parsed? I've seen TIMING=true usage in issues, and it currently works the same as TIMING=1.

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

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

Added TIMING=true to the list.

Comment on lines 76 to 79
const MINIMUM_SIZE = 10;
const TIMING_ENV_VAR_AS_INTEGER = Number.parseInt(process.env.TIMING, 10);

return Math.max(MINIMUM_SIZE, TIMING_ENV_VAR_AS_INTEGER);
Copy link
Member

Choose a reason for hiding this comment

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

For TIMING=true, this function will return NaN and display will show nothing as slice returns [] if the second argument was NaN.

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

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

Thanks, I fixed for the code for this case. Will also add test cases in the actual PR.

@btmills
Copy link
Member

btmills commented Sep 18, 2020

I like this 👍 Good idea @bmish. Thanks for catching those edge cases, @mdjermanovic. If it's not all or a successful parseInt() > 10, we should fall back to the existing behavior.

@bmish
Copy link
Sponsor Member Author

bmish commented Sep 18, 2020

Thanks for the feedback! Addressed.

Copy link
Member

@btmills btmills left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for the quick iteration!

Copy link
Member

@mdjermanovic mdjermanovic left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

@nzakas
Copy link
Member

nzakas commented Sep 24, 2020

Status update: we still need to leave this PR open for public comment for another nine days per our RFC process. Then we go into final commenting for seven days. It looks like there’s good alignment on the team, though, so I don’t expect any hiccups along the way.

@btmills btmills added Final Commenting This RFC is in the final week of commenting and removed Initial Commenting This RFC is in the initial feedback stage labels Oct 5, 2020
@btmills
Copy link
Member

btmills commented Oct 5, 2020

This has now been open for more than 21 days and currently has no unresolved questions, so I'm moving it to final commenting.

Copy link
Member

@anikethsaha anikethsaha left a comment

Choose a reason for hiding this comment

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

👍

@nzakas
Copy link
Member

nzakas commented Oct 14, 2020

No further issues were brought up regarding this RFC during the final commenting period, so marking this RFC as accepted and merging it.

@nzakas nzakas merged commit 0881edd into eslint:master Oct 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Final Commenting This RFC is in the final week of commenting
Projects
None yet
5 participants