Skip to content

[Optimization] Optimize DOM in status.js to improve performance#4604

Closed
AnvitaPrasad wants to merge 1 commit intosugarlabs:masterfrom
AnvitaPrasad:optimise-dom-status
Closed

[Optimization] Optimize DOM in status.js to improve performance#4604
AnvitaPrasad wants to merge 1 commit intosugarlabs:masterfrom
AnvitaPrasad:optimise-dom-status

Conversation

@AnvitaPrasad
Copy link
Copy Markdown
Contributor

Issue: #4461

DOM Optimization in status.js widget

This PR optimizes the DOM manipulation in the status widget to improve performance while maintaining the exact same functionality.

Optimizations implemented:

  1. Cached DOM elements and values:

    • Created a cell reference mapping system to avoid expensive DOM traversals
    • Cached frequently calculated values like font sizes and heights
    • Stored turtle list reference to avoid repeated property lookups
  2. Fixed redundant event handler assignments:

    • Consolidated the onmaximize event which was being redefined for each turtle
    • Now using a single handler that operates on all cells at once
  3. Reduced DOM traversal operations:

    • Replaced table cell lookups via row/cell indices with direct cached references
    • Implemented a cell mapping system for direct access during updates
  4. Memory and performance improvements:

    • Removed unnecessary variable recreations
    • Cached local references for frequent lookup paths
    • Eliminated redundant style calculations

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 6, 2025

✅ All Jest tests passed! This PR is ready to merge.

@AnvitaPrasad
Copy link
Copy Markdown
Contributor Author

@walterbender pls review . thanks

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 5, 2025

This pull request has been open for more than 60 days without any activity. It will be closed in 3 days unless the stale label is removed or commented on.

@github-actions github-actions Bot added the Stale label Jun 5, 2025
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 8, 2025

Closed pull request due to inactivity for more than 63 days.

@github-actions github-actions Bot closed this Jun 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant