Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Remove unused SORT_MARK_STACK code. - #123063

#123063
Merged
adityamandaleeka merged 1 commit into
dotnet:maindotnet/runtime:mainfrom
adityamandaleeka:remove_unused_sortmarkstackadityamandaleeka/runtime:remove_unused_sortmarkstackCopy head branch name to clipboard
Jan 12, 2026
Merged

Remove unused SORT_MARK_STACK code.#123063
adityamandaleeka merged 1 commit into
dotnet:maindotnet/runtime:mainfrom
adityamandaleeka:remove_unused_sortmarkstackadityamandaleeka/runtime:remove_unused_sortmarkstackCopy head branch name to clipboard

Conversation

@adityamandaleeka

Copy link
Copy Markdown
Member

This PR removes the SORT_MARK_STACK feature and related rqsort1 function from the GC. These aren't used and if we need them, we can always bring them back from history.

I don't know the full history here but I assume it's not enabled because the performance benefits weren't worth the sorting cost. Plus we have prefetch in the mark phase now which should help hide memory latency.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/gc
See info in area-owners.md if you want to be subscribed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR removes the unused SORT_MARK_STACK feature from the garbage collector. The feature was designed to sort the mark stack during GC marking phases to potentially improve memory access patterns, but it was never enabled in production builds. With prefetch optimization now available in the mark phase, this sorting code is no longer needed.

Changes:

  • Removed the rqsort1 function that implemented reverse quicksort for sorting mark stack entries
  • Removed all SORT_MARK_STACK conditional compilation blocks from both foreground and background GC marking functions

@AaronRobinsonMSFT

Copy link
Copy Markdown
Member

Is it possible this was a diagnostic tool used during GC development/debugging scenarios?

@VSadov

VSadov commented Jan 12, 2026

Copy link
Copy Markdown
Member

Not sure what the history of this either, but my guess would be the same as @adityamandaleeka -
Someone hoped that sorting mark stack would speed up marking, but it did not always help.

Marks stack typically covers only a small portion of the heap and in general can contain fairly random pointers, thus it can be too sparse to benefit from sorting.

@VSadov VSadov left a comment

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.

LGTM

@adityamandaleeka
adityamandaleeka merged commit fd07ebf into dotnet:main Jan 12, 2026
107 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Feb 12, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.