Switch to the mimalloc allocator - #484
Merged
Merged
Conversation
ZeWaka
marked this pull request as ready for review
September 30, 2026 03:48
Contributor
Author
|
Your choice if you want to mark #113 fixed by this (or a potential future proc body parsing split PR). |
Owner
|
Benched on Linux, also including dreamchecker CLI. Improvements are big on musl, smaller but still meaningful on glibc.
I might want to switch release builds off musl if I can! Here's the musl->glibc comparison:
|
SpaceManiac
approved these changes
Oct 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Switches the langserver from the default system allocator to mimalloc.
Gives a great speedup in parse time and a decrease in memory usage.
Mimalloc is more designed for the tiny short-lived allocations we're doing with the parser.
I chose
v2becausev3actually uses more memory. I looked into some other allocators but they didn't give much gains.Mimalloc does hold onto freed pages until another alloc or asked, so we force a collect at the end of heavy operations where there wouldn't be another alloc (server goes idle).
Median of 3 runs each on my local Windows machine:
Speedup is less on Linux (Well, WSL) because their allocator is less shite. More like 20% loading and memory reduction.
Sidenote:
I think even more gains could be had by splitting proc body parsing (about 50% of the used memory) out since the only things that use them are dreamchecker and Find References. Dropping it after dreamchecker and lazily reparsing on Find-Reference could be worth it.Yep, and didn't need to do reparsing lazily: #486