Skip to content

Prism slows down web browser when showing a large XML file#313

Merged
uhafner merged 3 commits intojenkinsci:mainfrom
akash-manna-sky:JENKINS-73298
May 5, 2026
Merged

Prism slows down web browser when showing a large XML file#313
uhafner merged 3 commits intojenkinsci:mainfrom
akash-manna-sky:JENKINS-73298

Conversation

@akash-manna-sky
Copy link
Copy Markdown
Contributor

Prism slows down web browser when showing a large XML file

Fixes #287

Testing done

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests that demonstrate the feature works or the issue is fixed

@github-actions
Copy link
Copy Markdown

☀️   Quality Monitor

Tests

   JUnit   Unit Tests: ✅ successful — 42 passed, 2 skipped
   🚀   Integration Tests: ✅ successful — 24 passed
   ⛔   Architecture Tests: ✅ successful — 15 passed

Coverage for New Code

   〰️   Line Coverage: 100.00% — perfect 🎉
   ➰   Branch Coverage: 100.00% — perfect 🎉

Coverage for Whole Project

   〰️   Line Coverage: 79.63% — 89 missed lines
   ➰   Branch Coverage: 73.76% — 37 missed branches

Style

   CheckStyle   CheckStyle: No warnings
   PMD   PMD: No warnings
   ☕   Java Compiler: No warnings

Bugs

   SpotBugs   SpotBugs: No bugs
   🐛   Error Prone: No bugs

Vulnerabilities

   🛡️   OWASP Dependency Check: 217 vulnerabilities — error: 17, high: 63, normal: 126, low: 11

Software Metrics

   🌀   Cyclomatic Complexity: 165 (total)
   💭   Cognitive Complexity: 75 (total)
   ➿   N-Path Complexity: 238 (total)
   📏   Lines of Code: 1859 (total)
   📝   Non Commenting Source Statements: 603 (total)
   🔗   Class Cohesion: 100.00% (maximum)
   ⚖️   Weight of Class: 100.00% (maximum)

🚦 Quality Gates

Overall Status: ✅ SUCCESS

✅ Passed Gates

  • ✅ Overall Tests Success Rate: 100.00 >= 100.00
  • ✅ Line Coverage in New Code: 100.00 >= 90.00
  • ✅ Branch Coverage in New Code: 100.00 >= 90.00
  • ✅ Potential Bugs in Whole Project: 0.00 <= 0.00
  • ✅ Style Violation in Whole Project: 0.00 <= 0.00

Created by Quality Monitor v4.11.0 (#484bbba). More details are shown in the GitHub Checks Result.

@akash-manna-sky akash-manna-sky marked this pull request as ready for review April 26, 2026 15:21
@uhafner uhafner added the bug Bugs or performance problems label May 4, 2026
Copy link
Copy Markdown
Member

@uhafner uhafner left a comment

Choose a reason for hiding this comment

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

Looks good, thanks! Can you simplify the code?

Comment on lines +34 to +35
private static final int MAX_LINES_FOR_SYNTAX_HIGHLIGHTING = Integer.getInteger(
SourcePrinter.class.getName() + ".maxLinesForSyntaxHighlighting", 5_000);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Simply use 5_000, it does not make sense to use properties in Jenkins. When required we can add a customization later...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you use the constant here as well?

Comment on lines +93 to +105
private int countLines(final StringBuilder text) {
if (text.isEmpty()) {
return 0;
}

int lines = 0;
for (int i = 0; i < text.length(); i++) {
if (text.charAt(i) == NEW_LINE) {
lines++;
}
}
return lines;
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Replace with sb.chars().filter(c -> c == '\n').count()

@github-actions github-actions Bot requested a review from uhafner May 5, 2026 10:34
Copy link
Copy Markdown
Member

@uhafner uhafner left a comment

Choose a reason for hiding this comment

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

Thanks!

@uhafner uhafner merged commit c475481 into jenkinsci:main May 5, 2026
29 checks passed
@akash-manna-sky akash-manna-sky deleted the JENKINS-73298 branch May 5, 2026 16:32
@akash-manna-sky
Copy link
Copy Markdown
Contributor Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Bugs or performance problems

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[JENKINS-73298] Prism slows down web browser when showing a large XML file

2 participants