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

Add and use snmalloc, mimalloc for allocation performance #10976

Open
WSLUser opened this issue Aug 18, 2021 · 4 comments
Open

Add and use snmalloc, mimalloc for allocation performance #10976

WSLUser opened this issue Aug 18, 2021 · 4 comments
Labels
Area-Performance Performance-related issue Help Wanted We encourage anyone to jump in on these. Issue-Task It's a feature request, but it doesn't really need a major design. Product-Meta The product is the management of the products.
Milestone

Comments

@WSLUser
Copy link
Contributor

WSLUser commented Aug 18, 2021

Description of the new feature/enhancement

Github randomly revealed a project from Microsoft that upon investigation seems like it would be pretty useful here to possibly boost performance for allocations. https://github.com/microsoft/snmalloc

Proposed technical implementation details (optional)

@WSLUser WSLUser added the Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. label Aug 18, 2021
@ghost ghost added Needs-Tag-Fix Doesn't match tag requirements Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Aug 18, 2021
@WSLUser WSLUser changed the title Add and use snmalloc Add and use snmalloc for allocations Aug 18, 2021
@zadjii-msft zadjii-msft added Area-Performance Performance-related issue Help Wanted We encourage anyone to jump in on these. Issue-Task It's a feature request, but it doesn't really need a major design. Product-Meta The product is the management of the products. and removed Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. labels Aug 18, 2021
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label Aug 18, 2021
@zadjii-msft zadjii-msft added this to the Icebox ❄ milestone Aug 18, 2021
@WSLUser WSLUser changed the title Add and use snmalloc for allocations Add and use snmalloc. mimalloc for allocations Aug 20, 2021
@WSLUser
Copy link
Contributor Author

WSLUser commented Aug 20, 2021

https://github.com/microsoft/mimalloc is more general purpose while snmalloc is for message-passing specifically. Use both as needed in places where allocations need to occur and can't simply be removed.

@WSLUser WSLUser changed the title Add and use snmalloc. mimalloc for allocations Add and use snmalloc, mimalloc for allocations Aug 20, 2021
@WSLUser WSLUser changed the title Add and use snmalloc, mimalloc for allocations Add and use snmalloc, mimalloc for allocation performance Aug 20, 2021
@WSLUser
Copy link
Contributor Author

WSLUser commented Aug 20, 2021

So it looks all we need to do here is add it to the build steps. contour-terminal/contour#341 shows how it's done for cmake. MSVC makes it bit more difficult as you need to ensure build steps are done properly in order and while I'd like to take a stab at this, I'm concerned about messing the build up trying to add this. I'd start with mimalloc first in this case and follow all of it's recommendations for flags for C++:

For best performance in C++ programs, it is also recommended to override the global new and delete operators. For convience, mimalloc provides mimalloc-new-delete.h which does this for you -- just include it in a single(!) source file in your project. In C++, mimalloc also provides the mi_stl_allocator struct which implements the std::allocator interface.

Also see https://github.com/microsoft/mimalloc#override-on-windows for Windows specific optimizing.

@WSLUser
Copy link
Contributor Author

WSLUser commented Aug 20, 2021

@skyline75489 Are you comfortable with messing with the build steps to see how much of a boost we get in Process Explorer?

@lhecker
Copy link
Member

lhecker commented Aug 21, 2021

Chester is unfortunately currently already preoccupied.
Since the benefits in Contour were rather significant I'll look into this in his stead.

@lhecker lhecker self-assigned this Aug 21, 2021
@DHowett DHowett removed the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label Aug 27, 2021
@lhecker lhecker removed their assignment May 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Performance Performance-related issue Help Wanted We encourage anyone to jump in on these. Issue-Task It's a feature request, but it doesn't really need a major design. Product-Meta The product is the management of the products.
Projects
None yet
Development

No branches or pull requests

4 participants