Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optimized (and ordered) IdSet code #52114

Merged
merged 4 commits into from
Nov 25, 2023
Merged

optimized (and ordered) IdSet code #52114

merged 4 commits into from
Nov 25, 2023

Conversation

vtjnash
Copy link
Member

@vtjnash vtjnash commented Nov 10, 2023

We have had this smallintset code around for a while for internal purposes, though it was not quite fully general purpose (it didn't have pop). We also have around this tiny global_roots_table (about 1500 entries after building the sysig). This saves about 50% of the space for storing that table. It also optimizes all other IdSet code to not be an inefficient mutable wrapper around an IdDict, but instead be an ordered (by first insertion) set type of its own.

@vtjnash vtjnash added performance Must go faster needs nanosoldier run This PR should have benchmarks run on it labels Nov 10, 2023
@vtjnash vtjnash requested a review from JeffBezanson November 10, 2023 05:06
Base automatically changed from jn/weakref-global_roots_table to master November 10, 2023 17:45
@vtjnash
Copy link
Member Author

vtjnash commented Nov 10, 2023

@nanosoldier runbenchmarks(!"scalar" && !"union", vs=":master")

@vtjnash vtjnash removed the needs nanosoldier run This PR should have benchmarks run on it label Nov 10, 2023
@vtjnash vtjnash marked this pull request as ready for review November 10, 2023 18:03
@nanosoldier
Copy link
Collaborator

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here.

@JeffBezanson
Copy link
Member

Are IdDict and IdSet represented in the benchmarks?

@vtjnash
Copy link
Member Author

vtjnash commented Nov 14, 2023

IdDict probably is, but is not affected by this PR. IdSet is probably not

Saves a little bit of memory and some pointer indirections since this
does not need resizing.
Makes this an almost-ordered set, using our existing idset optimization
for better memory utilization.
@vtjnash vtjnash added the merge me PR is reviewed. Merge when all tests are passing label Nov 20, 2023
@oscardssmith oscardssmith merged commit cb01a3b into master Nov 25, 2023
7 checks passed
@oscardssmith oscardssmith deleted the jn/orderedidset branch November 25, 2023 04:45
@oscardssmith oscardssmith removed the merge me PR is reviewed. Merge when all tests are passing label Nov 25, 2023
mkitti pushed a commit to mkitti/julia that referenced this pull request Dec 9, 2023
We have had this smallintset code around for a while for internal
purposes, though it was not quite fully general purpose (it didn't have
pop). We also have around this tiny global_roots_table (about 1500
entries after building the sysig). This saves about 50% of the space for
storing that table. It also optimizes all other IdSet code to not be an
inefficient mutable wrapper around an IdDict, but instead be an ordered
(by first insertion) set type of its own.
@stevengj
Copy link
Member

stevengj commented Dec 12, 2023

Are we thinking of exporting IdSet at some point?

(This just came up on discourse. With the latest optimizations, users can no longer simply use IdDict{T,Nothing} to get something equivalently good.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Must go faster
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants