Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Replace CQuickSort with qsort in GC info encoders. #4163

Merged
merged 1 commit into from
Apr 8, 2016

Conversation

pgavlin
Copy link

@pgavlin pgavlin commented Apr 8, 2016

This removes another utilcode dependency from the GC info encoders.

@pgavlin
Copy link
Author

pgavlin commented Apr 8, 2016

@russellhadley @jkotas @BruceForstall @dotnet/jit-contrib PTAL

This is part of #4127.

@CarolEidt
Copy link

I suspect that the perf will be pretty much a wash, but the GC info encoding was the source of some really bad outliers throughput-wise. I would recommend doing some throughput measurements.

This removes another utilcode dependency from the GC info encoders.
@BruceForstall
Copy link

Why do you bother changing the encoder code at all? Why not just extract CQuickSort into a separate file, without dependencies, and just use the code as-is? Then there would be no question about correctness or performance.

@pgavlin
Copy link
Author

pgavlin commented Apr 8, 2016

Why do you bother changing the encoder code at all? Why not just extract CQuickSort into a separate file, without dependencies, and just use the code as-is? Then there would be no question about correctness or performance.

Primarily because qsort is already used elsewhere in the encoder and the transformation is rather simple. In at least one of these uses it calls out that CQuickSort is prone to stack overflows, so standardizing on qsort seems safer and cleaner than the alternative.

As a secondary concern, CQuickSort is widely used throughout the runtime and the surgery necessary to make it dependency-free for the GC info encoder but still usable elsewhere is a bit ugly.

@BruceForstall
Copy link

Since you don't seem to be worried much about sharing source code, you could always create a clone of CQuickSort and rip out the VM-specific code (contracts) without affecting its behavior.

Your change makes two changes at once: (1) extracting dependencies from utilcode, and (2) rewriting to change algorithms/data structures in a way you argue is preferable.

These do not need to be conflated, and I believe #2 is unnecessary. Even if "general goodness", it's not clear we should spend time on this anyway.

@jkotas
Copy link
Member

jkotas commented Apr 8, 2016

Cloning and cleaning up CQuickSort to be standalone would be more work and larger delta that just switching the two places to qsort. The approach that @pgavlin has taken for this one makes sense to me.

@jkotas
Copy link
Member

jkotas commented Apr 8, 2016

LGTM

@pgavlin
Copy link
Author

pgavlin commented Apr 8, 2016

@CarolEidt: local testing indicates that any throughput differences are within the noise.
@BruceForstall: there were no assembly diffs (incl. GC info) with this change.

@pgavlin pgavlin merged commit 96580e4 into dotnet:master Apr 8, 2016
@pgavlin pgavlin deleted the GCInfoQSort branch April 8, 2016 22:20
@CarolEidt
Copy link

@pgavlin - thanks for testing!

picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
Replace CQuickSort with qsort in GC info encoders.

Commit migrated from dotnet/coreclr@96580e4
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.

6 participants