llvm-project: link against jemalloc#38
Merged
nickdesaulniers merged 1 commit intomainfrom Jul 1, 2022
Merged
Conversation
compnerd
approved these changes
Jul 1, 2022
Member
compnerd
left a comment
There was a problem hiding this comment.
This seems fine procedurally. I do have to ask - which malloc in musl was being used? There is oldmalloc and malloc-ng IIRC, and I'm curious if switching between those has any impact on performance. It would be nice to have that sort of information available to better explain the reasoning for the switch (and perhaps expand on that a bit more in the commit message).
Member
Author
|
Based on the disassembly, it looked like malloc-ng IIRC. Let me confirm, then collect some more number, then update the commit message. |
Member
Author
|
jemalloc: $ PATH=/android2/containers/llvm-project:$PATH /usr/bin/time -v make CC=clang LD=ld.lld -j72 -s
Command being timed: "make CC=clang LD=ld.lld -j72 -s"
User time (seconds): 2626.97
System time (seconds): 248.37
Percent of CPU this job got: 4774%
Elapsed (wall clock) time (h:mm:ss or m:ss): 1:00.22In the container, I can see that ${BUILD_DIR}/obj/src/malloc/ contains mallocng/ but not oldmalloc/. |
The following symbols from musl's malloc-ng implementation were
appearing in a perf profile of a kernel build within the top 20 hottest
symbols by cycle count.
malloc-ng:
Samples: 589K of event 'cycles:ppu', Event count (approx.): 11053523397362
Overhead Shared Object Symbol
+ 1.57% clang [.] __libc_malloc_impl
0.69% clang [.] __libc_free
+ 0.65% clang [.] alloc_slot
+ 0.58% clang [.] get_meta
$ /usr/bin/time -v make CC=clang LD=ld.lld -j72 -s
Command being timed: "make CC=clang LD=ld.lld -j72 -s"
User time (seconds): 2801.78
System time (seconds): 395.48
Percent of CPU this job got: 5212%
Elapsed (wall clock) time (h:mm:ss or m:ss): 1:01.33
jemalloc:
Samples: 569K of event 'cycles:ppu', Event count (approx.): 10681965442287
Overhead Shared Object Symbol
+ 0.55% clang [.] free
+ 0.41% clang [.] malloc
$ /usr/bin/time -v make CC=clang LD=ld.lld -j72 -s
Command being timed: "make CC=clang LD=ld.lld -j72 -s"
User time (seconds): 2626.97
System time (seconds): 248.37
Percent of CPU this job got: 4774%
Elapsed (wall clock) time (h:mm:ss or m:ss): 1:00.22
And these symbols are no longer in the top 20 hottest symbols by cycle
count.
Replace musl's malloc with jemalloc. Nothing major to write home about,
but gives a ~2.5% speedup by cycle count (N=1).
Fixes #36
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.
Uh oh!
There was an error while loading. Please reload this page.