Skip to content

perf: optimize text-table by replacing regex with trimEnd #19061

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

Merged
merged 8 commits into from
Nov 4, 2024

Conversation

snitin315
Copy link
Contributor

Prerequisites checklist

What is the purpose of this pull request? (put an "X" next to an item)

[ ] Documentation update
[ ] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofix to a rule
[ ] Add a CLI option
[ ] Add something to the core
[x] Other, please explain: Performance improvements

What changes did you make? (Give an overview)

Fix #18709

Is there anything you'd like reviewers to focus on?

I disabled some lint rules to avoid unwanted refactors in 3rd party code.

@snitin315 snitin315 requested a review from a team as a code owner October 27, 2024 09:53
@eslint-github-bot eslint-github-bot bot added the chore This change is not user-facing label Oct 27, 2024
@github-actions github-actions bot added cli Relates to ESLint's command-line interface formatter Relates to the formatters bundled with ESLint labels Oct 27, 2024
Copy link

netlify bot commented Oct 27, 2024

Deploy Preview for docs-eslint canceled.

Name Link
🔨 Latest commit 89efc43
🔍 Latest deploy log https://app.netlify.com/sites/docs-eslint/deploys/6726e34c647e3d0008ad96ae

Copy link
Contributor

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

Functional changes LGTM - it's easier to review when they're so close to the original! 🙂

But, something like half the file is dead code from over a decade ago. It feels odd to me to include so much of that in ESLint. Proposal: how about treating this as a fork of text-table and removing the portions that are never used?

@snitin315
Copy link
Contributor Author

I have resolved all the comments. Ready for a re-review.

Copy link
Contributor

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

There's some more code I think we can directly remove. But consider this a ✅ otherwise!

JoshuaKGoldberg
JoshuaKGoldberg previously approved these changes Nov 2, 2024
Copy link
Contributor

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

💯 awesome!

@mdjermanovic mdjermanovic added the accepted There is consensus among the team that this change meets the criteria for inclusion label Nov 2, 2024
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.

line:column was right-aligned:

image

But after this change, it would be left-aligned, and also seem to be breaking the table formatting:

image

@snitin315
Copy link
Contributor Author

@mdjermanovic Good catch! Fixed in 89efc43
Screenshot 2024-11-03 at 8 15 35 AM

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! Leaving open for @nzakas and @JoshuaKGoldberg to verify.

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.

LGTM. Waiting for @JoshuaKGoldberg to verify before merging.

Copy link
Contributor

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

Looks great to me, thanks!

@mdjermanovic mdjermanovic merged commit 6b75683 into main Nov 4, 2024
26 checks passed
@mdjermanovic mdjermanovic deleted the perf/text-table-refactor branch November 4, 2024 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion chore This change is not user-facing cli Relates to ESLint's command-line interface formatter Relates to the formatters bundled with ESLint
Projects
Status: Complete
Development

Successfully merging this pull request may close these issues.

Performance: long print time in stylish formatter's text-table for long report strings
4 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy