Skip to content

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

Merged
mdjermanovic merged 8 commits intomainfrom
perf/text-table-refactor
Nov 4, 2024
Merged

perf: optimize text-table by replacing regex with trimEnd#19061
mdjermanovic merged 8 commits intomainfrom
perf/text-table-refactor

Conversation

@snitin315
Copy link
Copy Markdown
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
@netlify
Copy link
Copy Markdown

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

Comment thread lib/cli-engine/formatters/text-table.js Outdated
Comment thread lib/cli-engine/formatters/text-table.js Outdated
Comment thread lib/cli-engine/formatters/text-table.js Outdated
Copy link
Copy Markdown
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?

Comment thread lib/cli-engine/formatters/text-table.js Outdated
Comment thread lib/cli-engine/formatters/text-table.js Outdated
@snitin315
Copy link
Copy Markdown
Contributor Author

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

Comment thread lib/shared/text-table.js Outdated
Copy link
Copy Markdown
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!

Comment thread lib/shared/text-table.js Outdated
Comment thread lib/shared/text-table.js Outdated
Comment thread lib/shared/text-table.js Outdated
JoshuaKGoldberg
JoshuaKGoldberg previously approved these changes Nov 2, 2024
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

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

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
@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